Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

For loop in script for dynamic field(calculated on condition)

Hi All,

I want to generate a table like this

Capture.PNG

Here,

Loco number is autogenerated field (through Rowno() i made it in backend)

Green highlighted columns will be given,rest all need to be filled accordingly.

Logic is :

The Yellow highlighted columns i.e. Loco Numbers must be filled by the [Total Units Recieved]/[Units/Loco] value.

For eg. if Total units received is 20 and Units/loco is 4 then till 5 locos 1,2,3,4,5 it should be filled.Likewise for all row values.

I tried by loop but i don't know where am i losing it.

Code i wrote :

Test_Unit_Table:

LOAD

Rowno() as Loco_No_1,

[Units/Loco],

[Total Units Received],

[Total Units Received]/[Units/Loco] as Final_Units

FROM [.../Test_Units_Table.xlsx]

(ooxml, embedded labels, table is Test_Units);

TestTab:

Set i;

For i=1 to 50

Load

Loco_No_1 ,

[Total Units Received] as TestTab_UnitsReceived,

Final_Units as TestTab_Final_Units,

[Units/Loco] as TestTab_UnitsPerLoco,

if([Total Units Received]<=Final_Units,$(i),[Units/Loco]) as Values_Filled

Resident Test_Unit_Table;

Next i;

Kindly help me on this.

Thanks.

0 Replies