hpng98
11th November 2002, 09:21
Hi.

I need to create an array ,and the value inside this array is
1 . rem
2 . Kg

then I need to use this array to get the record.

eg :

@unit = ("rem,"KG")

foreach $unit (@unit)
{
select * from tiitm001
where tiitm001.stgu ="$unit"
}

I use Perl language to show my logic,but how to write it in Baan??
Thanks alot.

morpheus
11th November 2002, 10:54
Hello,
If there are only two values, then why create an array!? But, if it is still required, then declare a string type, 2-dimensional array. Initialize the values, and then use them in the SQL. For more information, check Library.

jaapzwaan
11th November 2002, 11:25
hpng98,

If the array has an unknown content, try this:


domain ttadv.cpac cpac(2)
long test
long i

cpac(1,1) = "tt"
cpac(1,2) = "tc"

test = 0
for i = 1 to 2
SELECT *
FROM ttadv100
WHERE ttadv100.cpac = :1
WHEREBIND(1,cpac(1,i))
SELECTDO
test = test + 1
ENDSELECT
endfor


if the array fields are always fixed, do this:


SELECT *
FROM ttadv100
WHERE ttadv100.cpac in ( 'tt', 'tc' )
SELECTDO
test = test + 1
ENDSELECT


success,
Jaap Zwaan