Save !EXTRACT to specified column

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
Magikarp
Posts: 4
Joined: Fri Aug 26, 2016 8:43 pm

Save !EXTRACT to specified column

Post by Magikarp » Fri Aug 26, 2016 8:51 pm

Hello there,

i have a question regarding extracting information to a csv file. Whenever i try to extract several pieces of information from a website, save them to a csv file, and then arrange them across multiple columns in a single row it doesn't seem to work. To my knowledge, the following piece of code should lead to the value

Code: Select all

ADD !EXTRACT {{!VAR1}}
' This is the value i want to save to my csv file
SET !EXTRACT {{!COL3}}
' This *should* specify that i want to save it in the third column
...
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Piet\Desktop FILE=Template.csv
However, this doesn't put it in the third column, but in the third row. Is it possible somehow to somehow swap this? I don't want to keep transposing my tables in my .csv file afterwards :(
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Save !EXTRACT to specified column

Post by chivracq » Sat Aug 27, 2016 5:00 am

Magikarp wrote:Hello there,

i have a question regarding extracting information to a csv file. Whenever i try to extract several pieces of information from a website, save them to a csv file, and then arrange them across multiple columns in a single row it doesn't seem to work. To my knowledge, the following piece of code should lead to the value

Code: Select all

ADD !EXTRACT {{!VAR1}}
' This is the value i want to save to my csv file
SET !EXTRACT {{!COL3}}
' This *should* specify that i want to save it in the third column
...
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Piet\Desktop FILE=Template.csv
However, this doesn't put it in the third column, but in the third row. Is it possible somehow to somehow swap this? I don't want to keep transposing my tables in my .csv file afterwards :(
Shouldn't be a Pb from your Thread Title, I would think...
CIM...! :mrgreen: ... to read your Post...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Magikarp
Posts: 4
Joined: Fri Aug 26, 2016 8:43 pm

Re: Save !EXTRACT to specified column

Post by Magikarp » Sat Aug 27, 2016 1:06 pm

Sorry, i'm new here. Version of my Imacros is 8.9.7, of Firefox 48.0.2, and i use Windows 7.
In retrospect there are several subforums suitable for my query (as i use Firefox), so if anybody feels it should be moved that's fine.

Anyway, the problem still persists (and no, i don't know what a PB is :?: ).
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Save !EXTRACT to specified column

Post by chivracq » Sat Aug 27, 2016 2:15 pm

Magikarp wrote:Sorry, i'm new here.

Code: Select all

Version of my Imacros is 8.9.7, of Firefox 48.0.2, and i use Windows 7.
In retrospect there are several subforums suitable for my query (as i use Firefox), so if anybody feels it should be moved that's fine.

Anyway, the problem still persists (and no, i don't know what a PB is :?: ).
"Pb" = "Problem"...

OK, perfect for FCI (Full Config Info), always mention your FCI when you open a Thread, many Commands are not implemented for all Browsers/Versions...

Sub-Forum is fine...

OK, if I understand your Pb correctly, you want to save the Content of '!VAR1' into Col_3 of your '.CSV' File.
You don't need to use '!COL3' which would be to access the Content of Col_3 from a '.CSV' File that you would be using as a DataSource to input Data.

'SAVEAS TYPE=EXTRACT' is what you need indeed and it will save the Content of the '!EXTRACT' Var which is an Array and contains all Extracts you did in your Script. So if you had already 2 Extracts (or other 'ADD !EXTRACT ...' Statements) in your Script before your 'ADD !EXTRACT {{!VAR1}}', this Statement should be fine by itself and you don't need at all your 'SET !EXTRACT {{!COL3}}' which replaces the Content of '!EXTRACT' by '{{!COL3}}' which is probably "_Undefined_".

The following Script should work directly, and I've added 2 PROMPT's for you to understand how '!EXTRACT' gets built and you should get 3 Entries in the 2nd PROMPT separated by '[EXTRACT]':

Code: Select all

PROMPT {{!EXTRACT}}
ADD !EXTRACT {{!VAR1}}
' This is the value i want to save to my csv file
PROMPT {{!EXTRACT}}
...
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Piet\Desktop FILE=Template.csv
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply