Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GoTo Syntax

Status
Not open for further replies.

craiogram

MIS
Feb 20, 2004
126
US
I have googled and searched thru various posts but have found nothing on "goto" logic or syntax for ASP.

Does anybody know if ASP incorporates this type of logic and what the syntax would be.
Or would know how to work what I'm trying to do differently.

Purpose: I need to add a "<BR>" after every 4 pick/selection. But they could pick 1 at a time or 8-10 in 1 shot so I don't need to add the "<BR>" twice which is why I'm trying to get the "GOTO" to work for me.

Code:
dim brcnt
brcnt = rsMemInfo("brcntr") '1st time = 0

cnt4commaChk= 1 
for t=1 to 100
dim value
dim arrSelectionsHld4Cook
value = arrSelectionsHld(t-1)

if value = "" then
'nothing
else [COLOR=green]'a pick was made[/color]
arrSelectionsHld4Cook = arrSelectionsHld4Cook + (arrSelectionsHld(t-1))
brcnt = brcnt + 1
	if cnt4commaChk < cnt4comma then
	arrSelectionsHld4Cook = arrSelectionsHld4Cook + (",")
		if brcnt mod 4 = 0 then
		arrSelectionsHld4Cook = arrSelectionsHld4Cook + ("<BR>")
		[b][COLOR=red]goto passmod[/color][/b]
		end if
	end if 
	if brcnt mod 4 = 0 then
	arrSelectionsHld4Cook = arrSelectionsHld4Cook + ("<BR>")
	end if
	[b][COLOR=red]:passmod[/color][/b]
cnt4commaChk = cnt4commaChk + 1
end if
next

Thank you in advance!
 
Your objective is a little unclear, but it seems like you want to output a comma delimited list of values from an array in sets of 4 per line e.g.:

test2,test3,test3,test3
test2,test3,test2,test3
test3

Here's an example that will produce the above:
Code:
dim aValueList,i
aValueList = Array("test2","test3","test3","test3","test2","test3","test2","test3","test3")

for i=1 to ubound(aValueList)+1
	response.Write(aValueList(i-1))
	if i mod 4 = 0 then
		response.Write("<br/>")
	elseif i< ubound(aValueList)+1 then
		response.Write(",")
	end if
next

Adapting this for your needs should be pretty simple.

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top