For each row of a datatable

Hi Guys,

so far I managed to download some data from SAP, wrote it in Excel and uploaded one column with InvoiceNumbers to a Datatable in UIPath.

Now I would like to perform for each invoicenumber of the data table some steps:

  1. on a website (basically open website search number, and download the invoice) & save&rename the pdffile with the respective invoice number.
  2. go to a sap transaction open the invoicenumber and add the invoice pdf…
  3. Do that with all existing invoicenumbers of the datatable

I started with a for each activity but, it put all the invoices together in the website…
Now i dont really know how to continue.

Thanks for any hints how to continue :slight_smile:

Best,
Markus

Hi @Markus3003 !
Would you mind sharing with us your xaml file ? So that we could understand what is blocking you

Hi @Hiba_B ,

thanks for your answer! Not that much to share so far. :sweat_smile:

Adjust Excel Data.xaml (23.1 KB)

Alright, so what you are actually trying to type into is the whole datatable as a string, that’s why you are not getting the result expected.
What you really need is to type into only rows elements of the column called InvoiceNumbers, so you should do like this:

2 Likes

Yes that looks good, thank you :slight_smile:

Any idea how I can save/rename each pdf with the corresponding invoicenumber?

Hi @Markus3003

You can use move file activitiy for this

Regards

Nived N :robot:

Happy Automation

1 Like

Sure ! How do you trigger the saving of the file ? Is it through a button ?
To rename a file already locally saved in your computer, you can use “Move File”:

1 Like

Guys you are great! :slight_smile:
Thank you!!

1 Like

Yes exactly, with clicking on the save button…

image

I think/hope it should work with your describtion, i will try!

Thank you Hiba :slight_smile:

1 Like

Oh then you should directly write the right file name, without using move file activity !
In the Dateiname, you should type into:
folder path + "\" + row("InvoiceNumbers").tostring+".pdf"
and that’s it

1 Like

Hi @Markus3003

It’s better to use move file activitiy rather than going for UI Automation

Regards

Nived N :robot:

Happy Automation

Gosh, could you also tell me whats the best way to download the pdf from web?

UiPath is not recognizing the printer or download button in my case. :confused:

Thank you

@Markus3003 - You can use Either UiAutomation or Http request to download the pdfs…

You can also use Send hotkey activity with shortcut: Ctrl+Shift+s and then type into path with file name with extension. Last would be enter key for saving.

But API surely would be much faster.

If not downloading through API, you can click the download symbol and make sure to toggle the “Ask where to save each file before downloading” in Chrome download settings so the Save As window is shown.

Exactly, and to illustrate it you use Send Hotkey activity:
sned_hotkey
Beware of your selector, so that it fits different pdf

@Yameso would you mind explaining in details the API way ? I am interested to learn about it

I would love to but Im still begginer in that case :wink:

Here is connected topics:

But Im sure, some forum experts would help you :slight_smile:

1 Like

Try with this example from “http://www.africau.edu/images/default/sample.pdf”

Activity: Http Request
Properties:

@Markus3003

Hey Markus,

To get best out of this particular type of automation, i would suggest you to use Dispatcher and Performer concept.

  1. Dispatcher will add your invoice numbers to queue.
  • Download data from SAP

  • Add data to queue

And performer will come into picture.

  1. Performer
  • Get transaction item (one invoice number at time)
  • Download PDF and perform operations on SAP
  • update progress of invoice
  • Move to next invoice

This way it is easy to track, debug and avoid unnecessary loops and conditions.

To rename a file, use file system, this will help you FileSystem.RenameFile("C:\Test.txt", "SecondTest.txt")

To download any pdf file you can use
Either
Ctlr + P that will give you option to print file and save it as pdf
or use
Ctrl + S that will save pdf

Hi @Hiba_B ,

Can you see what I’m doing wrong? I get the error “row is no member of string” Thank you :slight_smile: