Excel qty

i have a excel sheet with some 12 rows

condition 1 : i have the qty as 6 in first row and if its 6 i need to have 6 more rows same as that
and if second rows qty is 7 i need to have 7 more rows same as second row

what logic to be given ?

Hi @poojaskyrathore ,

We would appreciate it if you could provide us with some sample data to work with, along with a short example of the output.

Kind Regards,
Ashwin A.K


base file

in base sheet you can see hightened first row has 6 and in second sheet that 1st row is repeated 6 times and same for the 2nd row

Hi @poojaskyrathore ,

Maybe you can Check the Below Post, It does have somewhat the similar requirement. Let us know if it doesn’t help :

Hello Pooja,

Inside the for each row loop, you have to get the quantity value in a variable. Then use a for loop and use “Add Data Row”. What happens is, it will add the rows according to the quantity value inside the for loop.

Thanks!
Athira

do you have any example ?

Please see the below screenshots. Here first column has the quantity values :


Hope it helps!
Athira

Hi @poojaskyrathore ,

Here is a short sequence to that addresses your problem →

image

dt.AsEnumerable().SelectMany(Function(s) Enumerable.Range(0,CInt(s.Item("qty"))).Select(Function(si) s).ToArray()).CopyToDataTable()

Sequence.xaml (8.5 KB)

Kind Regards,
Ashwin A.K

1 Like

assign thing is integer

so variable type what should i give ?

The quantity value should be stored in an integer variable.

Thanks,
Athira


i have given this … row(31) has qty and variable cloumn1 is assinged as interger in datatype

Hello @poojaskyrathore ,

This happened as the quantity value was empty. So what you can do is add a check to see if the value is empty or not. So the assign activity will become like this:
column1= if(row(31).tostring.Trim="",0,cint(row(31).tostring.Trim))

Please try like this and let me know.

Thanks!

this is my input sheet and can you see case column (the last one ) … in this if you see third row has 7 case and i want the entire row to be repeated 7 items

Yes, that’s what we are doing. Can you please show me your workflow so I can check it once?

Thanks,
Athira


Instead of running, can you give debug and see exactly where this error is coming?

assign thing is showing error

Can you please provide me the input excel that you are working with?

PO-CNNA080322-1 RAW PO.xlsx (19.8 KB)

last column has to be worked on