Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
please could you help me with below query. I want to duplicate row based on a stock value. my input will be from excel file
input :
Item Description stock Location
Tea Drink 350 shelf1
I want to divide stock with 100 so I can make 4 rows like output below.
output if stock less than 100
Item Description stock Location
Tea Drink 100 shelf1
output if stock more than 100
Item Description stock Location
Tea Drink 100 shelf1
Tea Drink 100 shelf1
Tea Drink 100 shelf1
Tea Drink 50 shelf1
Thanks.
Hi,
I got a solution, probably is not optimized but it's work.
Result for a row with 450 stock
TJavaflex_2 Code :
int Loop = Mathematical.SDIV(((Integer)globalMap.get("row5.stock")) , 100);
if(((Integer)globalMap.get("row5.stock")) % 100 > 0)
{
Loop = Loop + 1 ;
}
globalMap.put("LOOP", Loop);
tLoop Parameter
tJavaFlex_3 Code :
row7.item = ((String)globalMap.get("row5.item"));
row7.desc = ((String)globalMap.get("row5.desc"));
row7.location = ((String)globalMap.get("row5.location"));
if
(((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))==((Integer)globalMap.get("LOOP")))
{
if(((Integer)globalMap.get("row5.stock")) % 100!=0)
{
row7.stock = ((Integer)globalMap.get("row5.stock")) % 100;
}
else
{
row7.stock = 100;
}
}
else
{
row7.stock = 100;
}
Good luck ,
SGV
Hi,
I got a solution, probably is not optimized but it's work.
Result for a row with 450 stock
TJavaflex_2 Code :
int Loop = Mathematical.SDIV(((Integer)globalMap.get("row5.stock")) , 100);
if(((Integer)globalMap.get("row5.stock")) % 100 > 0)
{
Loop = Loop + 1 ;
}
globalMap.put("LOOP", Loop);
tLoop Parameter
tJavaFlex_3 Code :
row7.item = ((String)globalMap.get("row5.item"));
row7.desc = ((String)globalMap.get("row5.desc"));
row7.location = ((String)globalMap.get("row5.location"));
if
(((Integer)globalMap.get("tLoop_1_CURRENT_ITERATION"))==((Integer)globalMap.get("LOOP")))
{
if(((Integer)globalMap.get("row5.stock")) % 100!=0)
{
row7.stock = ((Integer)globalMap.get("row5.stock")) % 100;
}
else
{
row7.stock = 100;
}
}
else
{
row7.stock = 100;
}
Good luck ,
SGV