Extracted data from empty input field

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
cloullin
Posts: 20
Joined: Tue Sep 28, 2010 9:09 pm
Location: Luxemburg

Extracted data from empty input field

Post by cloullin » Wed Sep 04, 2013 10:04 pm

iMacro version: 8.3.0 BUILD=8300326
Windows XP SP3
Firefox 23.0.1

I try to extract the contents of the 7 fields in the picture below.
image.gif
image.gif (6.07 KiB) Viewed 3844 times
The macro I use:

Code: Select all

SET !DATASOURCE SA_soll.csv
SET !DATASOURCE_LINE {{!LOOP}}
'Extract filled in data
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule400* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule401* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule402* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule403* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule404* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule405* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule406* EXTRACT=TXT
FILEDELETE NAME=D:\My<SP>Documents\iMacros\Datasources\SA_ist.csv
SAVEAS TYPE=EXTRACT FOLDER=D:\My<SP>Documents\iMacros\Datasources FILE=SA_ist.csv
The order according to which the fields will be read is from left to right and from top to bottom. After running the macro the contents of SA_ist.csv will be:

Code: Select all

"16501","16502","","16503","16546",""
Why doesn't iMacros save an empty string to the file for the first input field as it does for the forth and the seventh. If the first field contains a number everything is fine, but when its empty the contents is completely ignored.

Thanks for your help.

Claude

P.S.: The HTML source code of this part of the page is:
(Unfortunately the site is password protected, so it won't help to give you the link.)

Code: Select all

<td class="tdValueServicePlan" >
        <ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[0].userServiceShiftIncViewItem.matricule" size="5" id="FieldMatricule40029403170" tabindex="305" />
...
		</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[0].userServiceShiftItem.user_service_shift_id" value="29403170" />
<td class="tdValueServicePlan" >
	<ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[1].userServiceShiftIncViewItem.matricule" value="16501" size="5" id="FieldMatricule40129403171" tabindex="306" />
...     
		</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[1].userServiceShiftItem.user_service_shift_id" value="29403171" />
<td class="tdValueServicePlan" >
	<ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[2].userServiceShiftIncViewItem.matricule" value="16502" size="5" id="FieldMatricule40229403172" tabindex="307" />
...
        	</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[2].userServiceShiftItem.user_service_shift_id" value="29403172" />
<td class="tdValueServicePlan" >
	<ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[3].userServiceShiftIncViewItem.matricule" size="5" id="FieldMatricule40329403173" tabindex="308" />
...
		</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[3].userServiceShiftItem.user_service_shift_id" value="29403173" />
<td class="tdValueServicePlan" >
	<ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[4].userServiceShiftIncViewItem.matricule" value="16503" size="5" id="FieldMatricule40429403174" tabindex="309" />
...
		</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[4].userServiceShiftItem.user_service_shift_id" value="29403174" />
<td class="tdValueServicePlan" >
	<ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[5].userServiceShiftIncViewItem.matricule" value="16546" size="5" id="FieldMatricule40529403175" tabindex="310" />
...
        	</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[5].userServiceShiftItem.user_service_shift_id" value="29403175" />
<td class="tdValueServicePlan" colspan="3">
	<ul>
		<li>
			<input type="text" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[6].userServiceShiftIncViewItem.matricule" size="5" id="FieldMatricule40629403176" tabindex="311" />
...
		</li>
	</ul>
</td>
<input type="hidden" name="dailyServiceShiftViewBeanList[4].serviceShiftBeanList[0].userServiceShiftBeanList[6].userServiceShiftItem.user_service_shift_id" value="29403176" />
Last edited by cloullin on Thu Sep 05, 2013 12:41 pm, edited 3 times in total.
chivracq
Posts: 8874
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extracted data from empty input field

Post by chivracq » Thu Sep 05, 2013 1:03 am

Maybe you need to put a "SET !EXTRACT NULL" (or empty String...?) before your first 'TAG ... EXTRACT'...?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
cloullin
Posts: 20
Joined: Tue Sep 28, 2010 9:09 pm
Location: Luxemburg

Re: Extracted data from empty input field

Post by cloullin » Thu Sep 05, 2013 8:53 am

chivracq wrote:Maybe you need to put a "SET !EXTRACT NULL" (or empty String...?) before your first 'TAG ... EXTRACT'...?
Sorry none of that worked.
chivracq
Posts: 8874
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extracted data from empty input field

Post by chivracq » Thu Sep 05, 2013 3:51 pm

I did some testing, it looks like a Bug to me, all the empty Input Fields until a Field is not empty are "forgotten" in !EXTRACT, missing the corresponding "[EXTRACT]" String(s)...

I managed to find a Workaround for you by modifying your Macro:

Code: Select all

SET !DATASOURCE SA_soll.csv
SET !DATASOURCE_LINE {{!LOOP}}

'Set !EXTRACT from "" to ".[EXTRACT]":
'(Replace "." by "zzz" if a dot may be used in your Input Fields...)
SET !EXTRACT .

'Extract filled in data
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule400* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule401* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule402* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule403* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule404* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule405* EXTRACT=TXT
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:ServicePlanFormBean ATTR=ID:FieldMatricule406* EXTRACT=TXT

'PROMPT {{!EXTRACT}}
'Remove the extra ".[EXTRACT]" at the beginning of !EXTRACT:
SET !VAR1 EVAL("var extract=\"{{!EXTRACT}}\"; extract.replace(\".[EXTRACT]\",\"\");")
SET !EXTRACT {{!VAR1}}
'PROMPT {{!EXTRACT}}

'Save the extracted Data:
FILEDELETE NAME=D:\My<SP>Documents\iMacros\Datasources\SA_ist.csv
SAVEAS TYPE=EXTRACT FOLDER=D:\My<SP>Documents\iMacros\Datasources FILE=SA_ist.csv
But it looks to me like a Bug...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
cloullin
Posts: 20
Joined: Tue Sep 28, 2010 9:09 pm
Location: Luxemburg

Re: Extracted data from empty input field

Post by cloullin » Fri Sep 06, 2013 10:13 pm

Cool, many thanks for the workaround.
How can we report the bug?
chivracq
Posts: 8874
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Extracted data from empty input field

Post by chivracq » Sat Sep 07, 2013 2:29 am

cloullin wrote:Cool, many thanks for the workaround.
How can we report the bug?
Happy I could help, I found your Problem inter/tain/est/ing... :twisted:

For the Bug, if I'm right at least..., don't worry, Tom from TechSupport will see it... 8)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply