Page 1 of 1

Function Array

Posted: Fri May 04, 2001 2:00 pm
by vaibhav.choksey
Hi I am trying to get bunch of IDs from my select statement. And I want to loop through the each id selected and create an Array of those IDs so that I can export that array to my vignette template.
I am planning to use
Select ID from Search where Name\title likep $strKeyword
It returns me ID as 1,2,3,4,5
Want to loop through it as
<loop $ID>
I want to create an Array with variable name as $IdArray. Can u give me an example on creating array in this way?
</loop>

Function Array

Posted: Fri May 04, 2001 2:13 pm
by bart
All variables are arrays in Vortex, try this to illustrate:

<sql max=5 "Select ID IDarray from Search where Name\title likep $strKeyword"></sql>

<loop $IDarray>
Array[$loop]=$IDarray<br>
</loop>

Function Array

Posted: Fri May 04, 2001 2:19 pm
by vaibhav.choksey
select $$$$rank rankval, RankValArray, ID, IDArray, PARENT_ID, PIDArray, PARENTY_TYPE_ID, PTArray
from cmp_Search
where NAME\TITLE likep $$strKeywordComplete
So I can create array of Rank too in same way right?
I will have to do:
<loop $IDarray>
Array[$loop]=$IDarray<br>
</loop>
<loop $PIDarray>
Array[$loop]=$PIDarray<br>
</loop>
<loop $PTIDarray>
Array[$loop]=$PTIDarray<br>
</loop>
<loop $RankValArray>
Array[$loop]=$RankValArray<br>
</loop>
Right? I can export IDArray, PIDArray, PTIDArray, RankValArray using EXPORT Tag?

Function Array

Posted: Fri May 04, 2001 2:24 pm
by bart
Please click "Edit User Info" and fill in the rest of your contact info so that I can call you.

Function Array

Posted: Fri May 04, 2001 3:30 pm
by bart
Tried to call you, but got your voice mail.

You kind of missed the point of my example above. The <loop> was only to print the values out and had nothing to do with assignment. EXPORT will export multiple valued variables. the following program will illustrate this. Please run it, it will help you understand both EXPORT and the array nature of Vortex vars.

Please also see this section of the Vortex tutorial: http://www.thunderstone.com/texis/site/ ... alues.html

<script language=vortex>
<export $b>

<a name=main>
<$a = apples grapes beans soup cheese>
<$b=$a>
<a href=$url/click.html>CLICK!</a>
</a>

<a name=click>
<loop $b>
Value: $b <br>
</loop>
</a>
</script>