Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I loaded test data with three rows for each Area and looped through the table using the peek function. I want to be able to access in a controlled manner to fill up sections of code based on Unit Area.
The following data file sample:
BusinessArea,BQLink,BQTitle,BQuestion
AreaNorth,https://www.msn.com, Requests for information North, Show me Question for North
AreaSouth,https://www.oracle.com, Requests for information South, Show me Question for South
AreaWest,https://www.yahoo.com, Requests for information West, Show me Question for West
AreaEast,https://www.Sybase.com, Requests for information East, Show me Question for East
AreaNorth,https://www.msn.com, Requests 2 for information North, Show me Question 2 for North
AreaSouth,https://www.oracle.com, Requests 2 for information South, Show me Question 2 for South
AreaWest,https://www.yahoo.com, Requests 2 for information West, Show me Question 2 for West
AreaEast,https://www.Sybase.com, Requests 2 for information East, Show me Question 2 for East
AreaNorth,https://www.msn.com, Requests 3 for information North, Show me Question 3 for North
AreaSouth,https://www.oracle.com, Requests 3 for information South, Show me Question 3 for South
AreaWest,https://www.yahoo.com, Requests 3 for information West, Show me Question 3 for West
AreaEast,https://www.Sybase.com, Requests 3 for information East, Show me Question 3 for East
My load script:
[Area Questions]:
LOAD
BusinessArea,
BQLink,
BQTitle,
BQuestion
FROM [lib://AttachedFiles/Area Questions.txt]
(txt, codepage is 28591, embedded labels, delimiter is ',', msq);
LET NumRows=NoOfRows([Area Questions]);
FOR i=0 to $(NumRows)-1
LET vBQBU=Peek('BusinessArea',$(i),[Area Questions]);
LET vBQL=Peek('BQLink',$(i),[Area Questions]);
LET vBQT=Peek('BQTitle',$(i),[Area Questions]);
LET vBQ=peek('BQuestion',$(i),[Area Questions]);
NEXT;
Then load the variables into an HTML Measure to propagate a dropdown menu of questions using the extension ShowHTMLasMeasure:
Its not cooperating and I'm sure I'm doing it incorrectly. Can anyone assist in my logic?
&'<li class="dropdown"> '
&' <a href="javascript:void(0)" class="dropbtn"> $(vBQBU)(1) </a> '
&' <div class="dropdown-content"> '
&' <a href="$(vBQBU)(1).$(vBQL)(1)" title=" $(vBQBU)(1).$(BQT) (1) "> $(vBQBU)(1).$(vBQ) (1) </a> '
&' <a href="$(vBQBU)(1).$(vBQL)(2)" title=" $(vBQBU)(1).$(BQT) (2) "> $(vBQBU)(1).$(vBQ) (2) </a> '
&' <a href="$(vBQBU)(1).$(vBQL)(3)" title=" $(vBQBU)(1).$(BQT) (3) "> $(vBQBU)(1).$(vBQ) (3) </a> '
&' </div> '
&' </li> '
&'<li class="dropdown"> '
&' <a href="javascript:void(0)" class="dropbtn"> $(vBQBU)(2) </a> '
&' <div class="dropdown-content"> '
&' <a href="$(vBQBU)(2).$(vBQL)(1)" title=" $(vBQBU)(2).$(BQT) (1) "> $(vBQBU)(2).$(vBQ) (1) </a> '
&' <a href="$(vBQBU)(2).$(vBQL)(2)" title=" $(vBQBU)(2).$(BQT) (2) "> $(vBQBU)(2).$(vBQ) (2) </a> '
&' <a href="$(vBQBU)(2).$(vBQL)(3)" title=" $(vBQBU)(2).$(BQT) (3) "> $(vBQBU)(2).$(vBQ) (3) </a> '
&' </div> '
&' </li> '
&'<li class="dropdown"> '
&' <a href="javascript:void(0)" class="dropbtn"> $(vBQBU)(3) </a> '
&' <div class="dropdown-content"> '
&' <a href="$(vBQBU)(3).$(vBQL)(1)" title=" $(vBQBU)(3).$(BQT) (1) "> $(vBQBU)(3).$(vBQ) (1) </a> '
&' <a href="$(vBQBU)(3).$(vBQL)(2)" title=" $(vBQBU)(3).$(BQT) (2) "> $(vBQBU)(3).$(vBQ) (2) </a> '
&' <a href="$(vBQBU)(3).$(vBQL)(3)" title=" $(vBQBU)(3).$(BQT) (3) "> $(vBQBU)(3).$(vBQ) (3) </a> '
&' </div> '
&' </li> '
Hi, that's not what I posted. Check it carefully, there are many things different.
Also the error message below seems that it lacks a semicolon after </tilte>';
Hi, the variable values are ovewritten in eah iteration of the FOR_NEXT bucle, so only the last values will keep.
You can create a variable at start like LET vHTML=''; and add to this variable on each iteration of the bucle, yo will need another bucle inside to iterate BQL, BQT and BQ.
LET NumRows=NoOfRows([Area Questions]);
LET vHTML=''
FOR i=0 to $(NumRows)-1
LET vBQBU=Peek('BusinessArea',$(i),[Area Questions]);
LET vHTML = '$(vHTML)'
&'<li class="dropdown"> '
&' <a href="javascript:void(0)" class="dropbtn"> $(vBQBU) </a> '
&' <div class="dropdown-content"> '
FOR j=1 to 3
LET vBQL=Peek('BQLink',$(j),[Area Questions]);
LET vBQT=Peek('BQTitle',$(j),[Area Questions]);
LET vBQ=peek('BQuestion',$(j),[Area Questions]);
LET vHTML = '$(vHTML)'
&' <a href="$(vBQBU).$(vBQL)" title=" $(vBQBU).$(BQT)"> $(vBQBU).$(vBQ)</a> '
&' <a href="$(vBQBU).$(vBQL)" title=" $(vBQBU).$(BQT)"> $(vBQBU).$(vBQ)</a> '
&' <a href="$(vBQBU).$(vBQL)" title=" $(vBQBU).$(BQT)"> $(vBQBU).$(vBQ)</a> '
NEXT;
NEXT;
LET vHTML = '$(vHTML)'
&' </div> '
&' </li> '
Great to hear from you and thank you for your response, i copied the above code to my ShowHTMLasMeasure extension in the measure and it gets errors. Is that where you thought it would go?
LET NumRows=NoOfRows([Area Questions]);
LET vHTML='';
FOR i=0 to $(NumRows)-1
LET vBQBU=Peek('BusinessArea',$(i),[Area Questions]);
LET vBQL=Peek(BQLink,$(j),[Area Questions]);
LET vBQT=Peek(BQTitle,$(j),[Area Questions]);
LET vBQ=peek(BQuestion,$(j),[Area Questions]);
&'<ul> '
&' LET vHTML = $(vHTML) '
&'<li class="dropdown"> '
&' <a href="javascript:void(0)" class="dropbtn"> $(vBQBU) </a> '
&' <div class="dropdown-content"> '
&' FOR j=1 to 3 '
&' LET vHTML = '$(vHTML)' '
&' <a href="$(vBQL)" title=" $(BQT)"> $(vBQ)</a> '
&' NEXT; '
&' NEXT; '
&' LET vHTML = '$(vHTML)' '
&' </div> '
&' </li> '
&'</ul> '
Hi, that's not what I posted. Check it carefully, there are many things different.
Also the error message below seems that it lacks a semicolon after </tilte>';
You are correct my friend, thank you for everything. Its working great now