mahalakshmi_s
asked on
ImportFile Error -4
I have the following code where I get retrun error = -4 (which is Invalid Input)
//ML sample
datastore lds_obj
lds_obj = create datastore
lds_obj.dataobject = "d_rps510_sort" // NO select stt associated here
lds_obj.SetTransObject(sql ca)
long ll_row
ll_row = lds_obj.ImportFile("C:\rps 510_sample .CSV")
If ll_row < 1 Then
MessageBox("Message","Erro r : [" + string(ll_row) + "]")
End If
string ls_sortorder
ls_sortorder = "parcel_id A" // use "A" for ascending or "D" for descending
lds_obj.SetSort(ls_sortord er)
lds_obj.Sort()
lds_obj.SaveAs("C:\rps510_ sample_sor ted.txt", CSV!, false)
MessageBox("Info","Output File Created")
Whats wrong above ? My datawindow has 17 columnss as that of CSV file and theor datatypes are same though.
Pls help
M
//ML sample
datastore lds_obj
lds_obj = create datastore
lds_obj.dataobject = "d_rps510_sort" // NO select stt associated here
lds_obj.SetTransObject(sql
long ll_row
ll_row = lds_obj.ImportFile("C:\rps
If ll_row < 1 Then
MessageBox("Message","Erro
End If
string ls_sortorder
ls_sortorder = "parcel_id A" // use "A" for ascending or "D" for descending
lds_obj.SetSort(ls_sortord
lds_obj.Sort()
lds_obj.SaveAs("C:\rps510_
MessageBox("Info","Output File Created")
Whats wrong above ? My datawindow has 17 columnss as that of CSV file and theor datatypes are same though.
Pls help
M
ASKER
My file doesnt have any col headings or row labels though...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
For example, I took just 2 lines of text file n tried Importing.
Maha PB10
XYZ ASA9
Well, if there is no comma and 2 words r separated by tab , then Import funtion works perfect. The above example works good.
But my original working TEXT file has commas ,inbetween all columns. Like
Maha,PB10
XYZ,ASA9
How can I convert the comma into TAB delimited, so that I can go ahead with further coding ?
Any idea ??
Many thx
Maha PB10
XYZ ASA9
Well, if there is no comma and 2 words r separated by tab , then Import funtion works perfect. The above example works good.
But my original working TEXT file has commas ,inbetween all columns. Like
Maha,PB10
XYZ,ASA9
How can I convert the comma into TAB delimited, so that I can go ahead with further coding ?
Any idea ??
Many thx
ASKER
I used Text! argument in SAVEAS method of datawindow and obtained what I wanted. Thx...
dwcontrol.ImportFile ( filename {, startrow {, endrow {, startcolumn {, endcolumn {, dwstartcolumn } } } } } )
The file should consist of rows of data.
----CHECK THIS----
If the file includes column headings or row labels, set the startrow and startcolumn arguments to skip them. The data types and order of the DataWindow object's columns must match the columns of data in the file.
----CHECK THIS----
If row 1 = headers or row labels then set startcolumn = 2 as this may be causing your issue.