Split PDF read data into variables

Hi!

I have made a robot that downloads PDF files from emails, and then reads the data. The data is then passed onto a string.

However, the PDF data is seperated by rows, for example it looks like this:

Customernumber
1234
Bookingday
2019-04-24
Deliveryday
2019-05-02

I want to make customernumber, bookingday and deliveryday variables and I want 1234, 2019-04-24, 2019-05-02 to be the value of those variables.

How can I create a data table that takes the first row as variable name, and then second as value and then makes the third line a variable again.

Unfortunately, it’s not always every second line being a variable / value.

For example one PDF looks like this:

customernumber
1234

bookingday
2019-04-24

deliveryday
2019-05-02

Recipient
Bill Belichick
Street Name 9
123456 New York
UNITED STATES

Easiest way would be to look for the customernumber and then take any text below that as value until “bookingdate” appears, but what’s the best practice of doing so?

Thanks, Emil

Make a datatable or a list from the string variables? As the structure will always be the same you can just call them by a number inside of the table or list.

@guemi

You can use Anchor Base activity to get the data. And also you can use string manipulations functions or regular expression to fetch required data.

Kind of what I was thinking too, but how to split up the string into variables?

Basically CustomerNumber should be a variable, and every following text up until “Bookingday” should be the value of CustomerNumber. How would one easiest make that?

Thanks in advance!

you could user string.split(variableCHAR) and split on every space or comma. Or find the right thing for your list with the string.contains(“item”) function.

Thank you, will check it out!

2 Likes