Question

How do I split the text after every line break after using pdf:extract field?


Badge +4

I have this pdf that I have used pdf:extract field action to select the data below to store to the variable called descriptionvar. So what I want my final output of each loop is to show:

 

Message box 1(loop 1)

Premium apples

Bought from Walmart

 

Message box 2(loop 2)

Premium Orange

 

This is how it would appear if I just display the descriptionvar in a messagebox. I deliberately highlighted the text so you can tell there is a 1 spacing at the empty third line. Don’t know why after using pdf:extract field, it will have one spacing at that empty line.

 

I have split the string using delimiter newline and stored into the Descriptionarray. and display out each index of Descriptionarray in a message box after that. Is my steps correct so far? video is here: https://www.awesomescreenshot.com/video/17683279?key=2ad1ce65b51e96687c8c5befb23c1ccc

what do i need to do next to achieve my results? 


12 replies

Userlevel 7
Badge +13

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

Userlevel 7
Badge +13

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

Userlevel 7
Badge +13

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

Userlevel 7
Badge +13

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

 

I think you are still confused. The index is basically can be altered using Counter variable which is starting with 0 (means the first item in the list) and goes on. At the end of the loop, you have to increment the counter so that, in the next iteration, it will pick up the second value from the list and print it out for you. The same will continue till the last item in the list.

 

I hope you got the logic.

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

 

I think you are still confused. The index is basically can be altered using Counter variable which is starting with 0 (means the first item in the list) and goes on. At the end of the loop, you have to increment the counter so that, in the next iteration, it will pick up the second value from the list and print it out for you. The same will continue till the last item in the list.

 

I hope you got the logic.

This is what you meant right? test combine | Edit Task Bot | Control Room | Automation Anywhere (awesomescreenshot.com) . You see, my first message box is Premium apple, second message box is Bought from walmart, third messagebox is empty, fourth messagebox is Premium orange, fifth messagebox is empty. What I want for my first messagebox is Premium apples and Bought from Walmart, second message box is Premium Orange and then the end.

Userlevel 7
Badge +13

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

 

I think you are still confused. The index is basically can be altered using Counter variable which is starting with 0 (means the first item in the list) and goes on. At the end of the loop, you have to increment the counter so that, in the next iteration, it will pick up the second value from the list and print it out for you. The same will continue till the last item in the list.

 

I hope you got the logic.

This is what you meant right? test combine | Edit Task Bot | Control Room | Automation Anywhere (awesomescreenshot.com) . You see, my first message box is Premium apple, second message box is Bought from walmart, third messagebox is empty, fourth messagebox is Premium orange, fifth messagebox is empty. What I want for my first messagebox is Premium apples and Bought from Walmart, second message box is Premium Orange and then the end.

 

 

This because you have split the same with New Line as delimiter. Hence, it will consider each line as a list item and the same will appear during each iteration.

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

 

I think you are still confused. The index is basically can be altered using Counter variable which is starting with 0 (means the first item in the list) and goes on. At the end of the loop, you have to increment the counter so that, in the next iteration, it will pick up the second value from the list and print it out for you. The same will continue till the last item in the list.

 

I hope you got the logic.

This is what you meant right? test combine | Edit Task Bot | Control Room | Automation Anywhere (awesomescreenshot.com) . You see, my first message box is Premium apple, second message box is Bought from walmart, third messagebox is empty, fourth messagebox is Premium orange, fifth messagebox is empty. What I want for my first messagebox is Premium apples and Bought from Walmart, second message box is Premium Orange and then the end.

 

 

This because you have split the same with New Line as delimiter. Hence, it will consider each line as a list item and the same will appear during each iteration.

 

So what can I do?

 

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

 

I think you are still confused. The index is basically can be altered using Counter variable which is starting with 0 (means the first item in the list) and goes on. At the end of the loop, you have to increment the counter so that, in the next iteration, it will pick up the second value from the list and print it out for you. The same will continue till the last item in the list.

 

I hope you got the logic.

This is what you meant right? test combine | Edit Task Bot | Control Room | Automation Anywhere (awesomescreenshot.com) . You see, my first message box is Premium apple, second message box is Bought from walmart, third messagebox is empty, fourth messagebox is Premium orange, fifth messagebox is empty. What I want for my first messagebox is Premium apples and Bought from Walmart, second message box is Premium Orange and then the end.

 

 

This because you have split the same with New Line as delimiter. Hence, it will consider each line as a list item and the same will appear during each iteration.

So what should I do?

Badge +4

Hi @PlayEatSleep ,

 

If you want the split text to pop up separately, you should use the loop and message box within it. 

Yes, I know this. but how do you make it so that when i put only one variable in the message box in the loop. It will give me each set of text on every line break that was selected from the pdf?

 

The String: Split action will give the output in a List type variable. You can loop through the list and mention the item name with the Index within the Message box for this purpose.

I dont want that as that is not practical, the selection that I did in the pdf might not only contain two sets of text the next time. there might be more items the next time round with a line break. so I do not want to specify a specific index in the message box. Each time it loops, I want the messagebox to display each set of items between every line break.

 

That is exactly what I am telling. No matter how much item you have split across, the loop works based on the number of items in the List variable. So technically, it will work even if there are more than 2 items.

But I don't want to always look at how many items I have In the pdf to know what index to print it out.

I have 10 plus invoices in a month that I need to get the item description. So each item description line will be printed to each row of my excel. How can you expect me to always put a specific index to get what value that I want? I am using a simple fruits example to replace my invoice items so people won't get confused.

 

 

 

I think you are still confused. The index is basically can be altered using Counter variable which is starting with 0 (means the first item in the list) and goes on. At the end of the loop, you have to increment the counter so that, in the next iteration, it will pick up the second value from the list and print it out for you. The same will continue till the last item in the list.

 

I hope you got the logic.

This is what you meant right? test combine | Edit Task Bot | Control Room | Automation Anywhere (awesomescreenshot.com) . You see, my first message box is Premium apple, second message box is Bought from walmart, third messagebox is empty, fourth messagebox is Premium orange, fifth messagebox is empty. What I want for my first messagebox is Premium apples and Bought from Walmart, second message box is Premium Orange and then the end.

 

 

This because you have split the same with New Line as delimiter. Hence, it will consider each line as a list item and the same will appear during each iteration.

 

Yes, this is what I was trying to show you on what you wanted me to do and I already told you it does not get what I want. You are not advising me on what do i need to do next to achieve my results? in my first post. My results is that I want my first messagebox to be Premium apples and Bought from Walmart, second message box to be Premium Orange.

Reply