How to set a variable to save rows for a specific value in excel?

Dear Expert

I have a request as below:

As you can see there are different product rows volume for each Billing Document

For HB00012345, there is only 1 row of product
For HB00012346 & HB00012347, there are only 2 rows of product
For HB00012348 & HB00012349, there are only 3 rows of product

How can I set a variable to identify the product row volume for each Billing Document?

image
Sample.XLSX (9.4 KB)

Thank you for your advise in advance :blush:

Hi @yangyq10 ,
Please follow the below steps:
1)Read the Excel file.
2)Extract the distinct values from the “Billing Document” column and store them in List.
dt_inputData.AsEnumerable().Select(Function(DR) DR(“Billing Document”).ToString).ToList.Distinct().ToList
3) Use a For Each loop to iterate through each item in the array and count the associated products.
count==> dt_inputData.AsEnumerable().Where(Function(DR) DR(“Billing Document”).ToString.Equals(currentItem.ToString)).Count.ToString
Please refer this xaml file it will help you


Main.xaml (11.8 KB)
Thanks,
Muthuraj

Hi @yangyq10

Please try this

GenerateInvoice.xaml (12.1 KB)

Regards,

1 Like

Hi @yangyq10

Hope this issue has been resolved in the previous post.

Regards

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.