hpng98
11th November 2002, 09:14
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.




HPNG

evesely
11th November 2002, 16:20
Try something like this:


domain tccuni arr.cuni(2)
domain tccuni use.cuni
long cnt
...
arr.cuni(1,1) = "rem"
arr.cuni(1,2) = "g"
...
for cnt = 1 to 2
use.cuni = arr.cuni(1,cnt)
select tiitm001.*
from tiitm001
where tiitm001.stgu = :use.cuni
selectdo
do.something
endselect
endfor


This is a very limited example. Obviously, you could adjust it to have a much larger array size, check for the "blank" array values, etc. This is just a "bare bones" example.

NPRao
11th November 2002, 19:51
You can also use wherebind -


domain tccuni arr.cuni(2)
long cnt
...
arr.cuni(1,1) = "rem"
arr.cuni(1,2) = "g"
...
for cnt = 1 to 2
select tiitm001.*
from tiitm001
where tiitm001.stgu = :1
wherebind(1, arr.cuni(1, cnt))
selectdo
do.something()
endselect
endfor