Page 1 of 1

Datasource larger than 16 records

Posted: Fri Aug 19, 2011 10:28 am
by Troiani
I edited the demo macro Loop-Csv-2-Web.iim to fill an online db. I play(loop) with repeat macro max=20. The loop always stops at loop 16 with the following error. Indeed, it seems the macro incorrectly reads only 5 fields instead of 7 from record 16 onward, thus causing the apparent corruption:
=========================================================================
Error -1230: The CSV appears to be corrupt near record '16' field '9 at position '848'. Current raw data : 'Nome,Indirizzo,Citta,CAP,Pr,Tel,Fax,Mob,CF,Part. IVA,Email,SitoWeb COMPANY1,VIA MAINSTREET 1,CITY,12345,AA,,,,,,, COMPANY2,VIA MAINSTREET 2,CITY,12345,AA,,,,,,, COMPANY3,VIA MAINSTREET 3,CITY,12345,AA,,,,,,, COMPANY4,VIA MAINSTREET 4,CITY,12345,AA,,,,,,, COMPANY5,VIA MAINSTREET 5,CITY,12345,AA,,,,,,, COMPANY6,VIA MAINSTREET 6,CITY,12345,AA,,,,,,, COMPANY7,VIA MAINSTREET 7,CITY,12345,AA,,,,,,, COMPANY8,VIA MAINSTREET 8,CITY,12345,AA,,,,,,, COMPANY9,VIA MAINSTREET 9,CITY,12345,AA,,,,,,, COMPANY10,VIA MAINSTREET 10,CITY,12345,AA,,,,,,, COMPANY11,VIA MAINSTREET 11,CITY,12345,AA,,,,,,, COMPANY12,VIA MAINSTREET 12,CITY,12345,AA,,,,,,, COMPANY13,VIA MAINSTREET 13,CITY,12345,AA,,,,,,, COMPANY14,VIA MAINSTREET 14,CITY,12345,AA,,,,,,, COMPANY15,VIA MAINSTREET 15,CITY,12345,AA,,,,,,, COMPANY16,VIA MAINSTREET 16,CITY,12345,AA,,,,, COMPANY17,VIA MAINSTREET 17,CITY,12345,AA,,,,, COMPANY18,VIA MAINSTREET 18,CITY,12345,AA,,,,, COMPANY19,VIA MAINSTREET 19,CITY,12345,AA,,,,, COMPANY20,VIA MAINSTREET 20,CITY,12345,AA,,,,, '.. Line 12: SET !DATASOURCE_LINE {{!LOOP}}
=========================================================================
- my imacro follows:
=========================================================================
VERSION BUILD=7361445
'Uses a Windows script to submit several client datasets to a website, for filling an online database
TAB T=1

' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file
'CSV = Comma Separated Values in each line of the file
SET !DATASOURCE Officina_Carica.csv
'Start at line 2 to skip the header in the file
SET !LOOP 2

'Increase the current position in the file with each loop
SET !DATASOURCE_LINE {{!LOOP}}
TAG POS=1 TYPE=A FORM=ID:form ATTR=CLASS:TitoloMarchioStampa2K
' Fill web form
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Nome CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Indirizzo CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Citta CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Cap CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Pro CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Telefono CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Fax CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Cellulare CONTENT={{!COL8}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:CodiceFiscale CONTENT={{!COL9}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:PartIva CONTENT={{!COL10}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Email CONTENT={{!COL11}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form ATTR=NAME:Sito CONTENT={{!COL12}}
TAG POS=1 TYPE=INPUT:BUTTON FORM=ID:form ATTR=VALUE:Salva
=========================================================================
- section of my dataset follows:
=========================================================================
Nome Indirizzo Citta CAP Pr Tel Fax Mob CF Part. IVA Email SitoWeb
COMPANY1 VIA MAINSTREET 1 CITY 12345 AA
COMPANY2 VIA MAINSTREET 2 CITY 12345 AA
COMPANY3 VIA MAINSTREET 3 CITY 12345 AA
COMPANY4 VIA MAINSTREET 4 CITY 12345 AA
COMPANY5 VIA MAINSTREET 5 CITY 12345 AA
COMPANY6 VIA MAINSTREET 6 CITY 12345 AA
COMPANY7 VIA MAINSTREET 7 CITY 12345 AA
COMPANY8 VIA MAINSTREET 8 CITY 12345 AA
COMPANY9 VIA MAINSTREET 9 CITY 12345 AA
COMPANY10 VIA MAINSTREET 10 CITY 12345 AA
COMPANY11 VIA MAINSTREET 11 CITY 12345 AA
COMPANY12 VIA MAINSTREET 12 CITY 12345 AA
COMPANY13 VIA MAINSTREET 13 CITY 12345 AA
COMPANY14 VIA MAINSTREET 14 CITY 12345 AA
COMPANY15 VIA MAINSTREET 15 CITY 12345 AA
COMPANY16 VIA MAINSTREET 16 CITY 12345 AA
COMPANY17 VIA MAINSTREET 17 CITY 12345 AA
COMPANY18 VIA MAINSTREET 18 CITY 12345 AA
COMPANY19 VIA MAINSTREET 19 CITY 12345 AA
COMPANY20 VIA MAINSTREET 20 CITY 12345 AA
=========================================================================
- iMacros Version: 7.36.1445
- Windows: XP SP3
- browser: IE 6.0.2900.5512.xpsp_sp3_gdr.101209-1647
- included demo macros work ok
- site: http://www.assistonline.it/Marelli/Clie ... lienti.asp (requires login)

Thank you.

Re: Datasource larger than 16 records

Posted: Fri Aug 19, 2011 10:53 am
by MattBell7
looking at your data you've got a load of blank columns after your data.

row 15 has 7 of them ,,,,,,,
row 16 has 5 of them ,,,,,

your rows MUST have the same number of columns, or iMacros will get confused.

Re: Datasource larger than 16 records

Posted: Fri Aug 26, 2011 7:49 pm
by Troiani
Thank you, MattBell7. Indeed that's the problem. After setting all records to the same number of fields (commas), the upload goes through flawlessly.

It turns out that Excel, which I'm using to generate the csv datasource from a standard xls sheet, is dropping the separators for some empty fields (but not all) :evil: . Now that I know this, I verify the csv output with notepad before feeding it to iMacros.