How-to use multiple "Take DOM"s and record in CSV format?

teeone

Новичок
Регистрация
30.05.2013
Сообщения
4
Благодарностей
0
Баллы
0
I am looking to record multiple lines of "Take DOM" information and save it to CSV format but I'm having problems figuring out the best way to get ZennoPoster to do this.

Here is my target information:

{ FirstName : "George", LastName : "Mitchell"},
{ FirstName : "Bob", LastName : "Jones"},
{ FirstName : "Mike", LastName : "Johnson"},
I would like to record this into a CSV file like this:

George,Mitchell
Bob,Jones
Mike,Johnson
It strikes me as something relatively simple but I have yet to see any tutorial videos or explanation of what I need.

The problem is if I use Take DOM Regex to capture "All" of FirstName, it will come out GeorgeBobMike. If I use "First" in my Take DOM, it will grab George everytime. How would I tell ZennoPoster to move to the 2nd, then 3rd, then 4th, etc match? Would somehow using counters be my solution?

I'm looking for some advice on how to best accomplish my goal of recording information into a CSV file so I can load it into MS Excel.
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Did you see my video here?
https://www.youtube.com/watch?v=OFdd91R4L9o
I know this is for version 3 but the same thing applies. In MP everything is loaded into a list instead and there is no need for counters so you can just take lines from the list and add them to a table.

*Note* there is a problem that the developers know about when working with .csv files. But if you have excel you can save them as xlsx files. Here's a sample template.

Посмотреть вложение Dom2CSV.xmlz
 
  • Спасибо
Реакции: Stroks

teeone

Новичок
Регистрация
30.05.2013
Сообщения
4
Благодарностей
0
Баллы
0
Thank you much for the sample xmlz file! Much appreciated. Your method works fine except for when I try more to pipe more than 3 regex expressions together. When I do this I get the error:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Any idea why this would be? I even tried separating the regex searches into 3 different "Take" actions, it doesn't seem to matter.

I searched around on Google with my error, which brought up a few threads from zennolab forums but all they mention is checking to make sure your file is located in the right spot. But my error comes even before writing anything to my table, so that can't be the problem.

Thanks for your help!
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
That means that your list is empty. I didn't have an unsuccessful exit out of the template because it was just an example, but when pulling lines from a list like in the template, eventually the list will be exhausted and you have to account for that. Usually you will have a pause or alert if that will be the end of the template. If you want to do something else, just connect it to the red dot of the Get Line action in the list processing.

Other than that, it shouldn't matter how many pipes you have as long as the regex is right.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)