I am dynamically creating a where clause for a choose statement. The problem occurs when there is more than 2 lots. It will loop through correctly (say 3 times), but only adds the first 2 lots to my where clause (CRITERE). Is there a limitation on how long a where clause can be in Sage X3 v6? Here is my code:
Local Integer I : I=0
Local Char CRITERE
Local File STOALL [STA1]
& Where ([F:STA1]VCRNUM = [F:SDD]SDHNUM) & ([F:STA1]VCRLIN = [F:SDD]SDDLIN)
For [STA1]
If I = 0
CRITERE = "STOCOU=" + num$([STA1]STOCOU)
I=1
ELSE
CRITERE = CRITERE + " or STOCOU=" + num$([STA1]STOCOU)
Endif
Next
If I = 0
Infbox("Record " + [F:SDD]SDHNUM) + " DOES not exist in STOALL table"
Else
Infbox (CRITERE)
Endif
If !clalev([F:STO]): Local File STOCK[STO]: Endif
Choose [STO]
& Where (([F:STO]STOFCY = [F:STA1]STOFCY) & evalue(CRITERE))
& Order By evalue("LOT") Using
& [STO]LOT Titled "Lot",
& [STO]ITMREF Titled "Product",
& [STA1]VCRNUM Titled "Shipper #",
& [STA1]VCRLIN Titled "Shipper Line #",
& [STA1]QTYSTUACT Titled "Qty"
& Sized (80,175)
& Titled "Lot Selection Window"