How to save rows column by column?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
cjseriy
Posts: 16
Joined: Wed Jul 04, 2018 12:53 pm

How to save rows column by column?

Post by cjseriy » Sat Jul 07, 2018 5:08 pm

Hello,

Could you tell me please how can I save row that consists of several columns so that the value of the first column saves first that when 2nd value is extracted, it saves to 2nd column, etc.

For example I have 4 values. In the example below it will save them as a 2 column 2 rows.

Code: Select all

TAG ... EXTRACT=...
TAG ... EXTRACT=...
SAVEAS TYPE=EXTRACT ...
TAG ... EXTRACT=...
TAG ... EXTRACT=...
SAVEAS TYPE=EXTRACT ...
But what if I want to save the 1st value of a row that is 1st column 1st row just immediately after it was extracted.

Like this:

Code: Select all

TAG ... EXTRACT=...
--save to 1st column, 1st row
TAG ... EXTRACT=...
--save to 2nd column, 1st row
SAVEAS TYPE=EXTRACT ...
TAG ... EXTRACT=...
--save to 1st column, 2nd row
TAG ... EXTRACT=...
--save to 2nd column, 2nd row
SAVEAS TYPE=EXTRACT ...
Actually I have multiple columns and 1 row that saves each time iMacros runs but sometimes errors occur in the middle and since SAVEAS is at the end of a file nothing is being stored at all.


VERSION BUILD=11.5.498.2403
Windows 10
iMacros 8.8.2.1
Pale Moon 26.3.3
chivracq
Posts: 8195
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to save rows column by column?

Post by chivracq » Sun Jul 08, 2018 8:48 am

cjseriy wrote:

Code: Select all

VERSION BUILD=11.5.498.2403 
Windows 10 
iMacros 8.8.2.1
Pale Moon 26.3.3
Hello,

Could you tell me please how can I save row that consists of several columns so that the value of the first column saves first that when 2nd value is extracted, it saves to 2nd column, etc.

For example I have 4 values. In the example below it will save them as a 2 column 2 rows.

Code: Select all

TAG ... EXTRACT=...
TAG ... EXTRACT=...
SAVEAS TYPE=EXTRACT ...
TAG ... EXTRACT=...
TAG ... EXTRACT=...
SAVEAS TYPE=EXTRACT ...
But what if I want to save the 1st value of a row that is 1st column 1st row just immediately after it was extracted.

Like this:

Code: Select all

TAG ... EXTRACT=...
--save to 1st column, 1st row
TAG ... EXTRACT=...
--save to 2nd column, 1st row
SAVEAS TYPE=EXTRACT ...
TAG ... EXTRACT=...
--save to 1st column, 2nd row
TAG ... EXTRACT=...
--save to 2nd column, 2nd row
SAVEAS TYPE=EXTRACT ...
Actually I have multiple columns and 1 row that saves each time iMacros runs but sometimes errors occur in the middle and since SAVEAS is at the end of a file nothing is being stored at all.

VERSION BUILD=11.5.498.2403
Windows 10
iMacros 8.8.2.1
Pale Moon 26.3.3
Ah-ah, love your FCI, ah-ah...!, looks very familiar, youpidoo...! :D

Yeah, but, nope..., every 'SAVEAS TYPE=EXTRACT' will create a New Row in your 'SAVEAS' File, and you need indeed to "prepare" the Content of the '!EXTRACT' Var for how you want your Data to be saved in the File...

Only Solution if you want to save Cell by Cell (in a same Row) would be to use some Online GoogleDoc I would think, opened in some 2nd Tab...
But, hum..., even using GoogleDocs is not very "staightforward", as you can see from this Thread where I did a bit of Testing:
- Re: Extract A Cell from Google Sheet or a CSV
("Useless" User in that Thread btw, 2nd time I try to help them, and 2nd time no Follow-up at all, grrr...! :shock: )

There is a "cumbersome" Solution where you can re-extract the complete Content of a '.CSV', add the last 'EXTRACT', delete the previous '.CSV', and re-save it all each time, but it's very cumbersome... :shock:
I actually do stg like that myself, for some Script that never knows how many times it will need to run (decides by itself), and often adds some extra Run "dynamically" and keeps some Temp Data in some Temp File, to (hopefully) save on the Final Run..., with a "nice" ('MacroError()') Report for me...! 8)
But pfff..., it's a bit "complex", each time I need to dig into again and modify stg..., I need a few hours to "understand" again "how I did it", and to locate again all the many Places in a 5000+ Line Script that play a Role, ah-ah...! :oops:
OK, only 2 Cols for you, that might be easier then, lucky you...!! :wink:

If you are "afraid" stg might go "wrong" between extracting your Content meant for 'Col_1' and 'Col_2' in your 'SAVEAS', you could already do a 'SAVEAS' once you have the Content for 'col_1' in some Temp '.CSV', that you can retrieve again just before doing the "Full" 'SAVEAS' with both Cols... But, hum..., a little bit cumbersome, I would think..., I've always had a very-very bad Connection, all my Scripts are double-triple prepared for Connection Loss and missing Pages, missing Extracts..., and will simply decide by themselves to run again if any "Blocking" or too many "Checkpoints" failed..., but I've never gone for "half-saving" all the Data I want in one Row one by one Cell...., if stg goes wrong, that part or the whole Script will run again...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
cjseriy
Posts: 16
Joined: Wed Jul 04, 2018 12:53 pm

Re: How to save rows column by column?

Post by cjseriy » Sun Jul 08, 2018 2:10 pm

Thank you very much for all your help! :)
Google Sheets I think will slow down an execution so I for now I will stick with this solution: Every first row will contain date and 1st value (2 cells) and all the following values within one play of a script will be stored row by row where 1st column will be empty. So even if iMacros fails after 2nd value it will save them all and will look like:

Code: Select all

Date; A
null;B
Date;A
null;B
null;C
null;D
Regarding FCI yes I used your recommendations :D Unfortunately I found out that some of sites internal scripts doesnt work in that browser as expected.
Like:

Code: Select all

document.getElementsByClassName("pull-left")[1].lastElementChild.innerText='26'; 
The command works in Console but changes are not seen in actual site's UI. So I am going to test some software that prevents RAM leakage in FF.
chivracq
Posts: 8195
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to save rows column by column?

Post by chivracq » Sun Jul 08, 2018 10:51 pm

cjseriy wrote:Thank you very much for all your help! :)
Google Sheets I think will slow down an execution so I for now I will stick with this solution: Every first row will contain date and 1st value (2 cells) and all the following values within one play of a script will be stored row by row where 1st column will be empty. So even if iMacros fails after 2nd value it will save them all and will look like:

Code: Select all

Date; A
null;B
Date;A
null;B
null;C
null;D
Regarding FCI yes I used your recommendations :D Unfortunately I found out that some of sites internal scripts doesnt work in that browser as expected.
Like:

Code: Select all

document.getElementsByClassName("pull-left")[1].lastElementChild.innerText='26'; 
The command works in Console but changes are not seen in actual site's UI. So I am going to test some software that prevents RAM leakage in FF.
Hum, OK, that's a simpler Implementation indeed...

Concerning PM v26.3.3 and iMacros v8.8.2 for FF, I think v8.8.7 works also on PM26, or even PM27.
As "it works for me" for the Sites I use my Macros on, and with the Commands and Functionality I use in my Scripts, I usually stick to some FCI for as long as I can when it works, especially with FF from FF57 and "Hassle" with v9.0.3 and now with v10...

And yep, I moved to PM, about 5 years ago now, not long after I joined the Forum actually, and the "main" Reason for me to switch from FF to PM was also the "useless" and endless Memory Leaks from FF + constant High Use of CPU... :roll:
I'll be interested to hear about your "Tool" that can/could prevent Memory Leaks from FF... 8)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply