Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to iterate loading in script using variable, which usually works fine but this script halts reloading:
----
FOR i = 2 TO 6
left join (MatTransProducts)
load Distinct
ParentObjID as IngredientObjectID$(i-1),
ParentObjID as IngredientParentID$(i),
IngredientObjectID1 as IngredientObjectID$(i),
IngredientLotNo as IngredientLotNo$(i),
IngredientItemNo as IngredientItemNo$(i),
IngredientItemDesc as IngredientItemDesc$(i),
IngredientItemType as IngredientItemType$(i)
Resident MatTransProducts;
NEXT i
----
Is it the naming of fields using variable that need modification?
Hi,
You cannot do the calculation $(i-1)
Try like this :
FOR i = 2 TO 6
let j=i-1;
left join (MatTransProducts)
load Distinct
ParentObjID as IngredientObjectID$(j),
ParentObjID as IngredientParentID$(i),
IngredientObjectID1 as IngredientObjectID$(i),
IngredientLotNo as IngredientLotNo$(i),
IngredientItemNo as IngredientItemNo$(i),
IngredientItemDesc as IngredientItemDesc$(i),
IngredientItemType as IngredientItemType$(i)
Resident MatTransProducts;
NEXT i
Regards
Hi,
You cannot do the calculation $(i-1)
Try like this :
FOR i = 2 TO 6
let j=i-1;
left join (MatTransProducts)
load Distinct
ParentObjID as IngredientObjectID$(j),
ParentObjID as IngredientParentID$(i),
IngredientObjectID1 as IngredientObjectID$(i),
IngredientLotNo as IngredientLotNo$(i),
IngredientItemNo as IngredientItemNo$(i),
IngredientItemDesc as IngredientItemDesc$(i),
IngredientItemType as IngredientItemType$(i)
Resident MatTransProducts;
NEXT i
Regards
Thanks - works!
Actually I left out the "=" I tried using in the i-j calculation: ParentObjID as IngredientObjectID$(=i-1)
... but that didn't work either. Adding a second variable works just fine.