Page 1 of 1
importing a file
Posted: Wed May 26, 2010 5:30 am
by Glenn Boyce
I want to load a text file from my H drive into a table field. i've tried the syntax below but can't get it to go.
Code: Select all
put URL ("file:" & "H:/Excel/Revolution/Stock files from QAD") into fld "StockCover" of card "Planning"
would someone please set my right!
Thanks
Glenn
Re: importing a file
Posted: Wed May 26, 2010 6:02 am
by dickey
Hello Glenn,
Perhaps you need to specify the file extension. Or alternatively you could try open file, read from file, close file etc.
How did you go connecting you scales to your PC?
Kind regards,
Andrew
Re: importing a file
Posted: Wed May 26, 2010 12:22 pm
by Klaus
Hi Glenn,
if you really have this file with exactly this name on your hd, then you could check for possible problems like this:
...
put URL ("file:" & "H:/Excel/Revolution/Stock files from QAD") into aVariable
answer the result
## "the result" is empty on success and may give a hint on what goes wrong otherwise
...
Best
Klaus
Re: importing a file
Posted: Wed May 26, 2010 11:41 pm
by Glenn Boyce
Hi Andrew and Klaus
Haven't looked at the scales thing yet. Got some more basic issues to resolve first. Mean time we'll just manually enter the weight data.
I notice that in the code I supplied that i didn't have the actual file name at the end. I added that and used the answer result script and when i execute the script it says it can't open file which doesn't help me a lot!
Re: importing a file
Posted: Thu May 27, 2010 4:26 am
by Curry
First, either use "answer file" to choose the file, or put your path in a variable and use "if there is a file" to verify you're correct.
Every character matters in the path, it's unforgiving, so you have to double-check.
Then, make sure you don't have the file open in another app! You might think for read-only it wouldn't matter, but it could be locked.
Re: importing a file
Posted: Fri May 28, 2010 12:22 am
by Glenn Boyce
I'm really struggling with this. I thought it would be easy peasy! I can't get the file to open and have cut and pasted the file location only changing the \ to / as i understand I'm meant to do. Would putting the file i want to open in a directory close to the application help? I was trying to pull it in from a remote drive.
Re: importing a file
Posted: Fri May 28, 2010 12:29 am
by Glenn Boyce
I have created the following:
Code: Select all
on mouseup
answer file "Select a file to open:"
put it
end mouseup
this gives me the answer in the message box:
H:/Excel/Revolution/QADFiles/stock.txt
Now I want to put the contents of that file into a table field called "StockCover"
I've tried opening the file using:
Code: Select all
put URL ("file:" & "H:/Excel/Revolution/QADFiles/stock.txt")into aVariable --into fld "StockCover" of card "Planning"
answer the result
the result is "Can't open file"
I've looked at the file and it's not locked or used on anything else. It is an excel file saved as a text file which I can upload manually into fld "StockCover" without any issues at all. All I want to do is automate that process!
cheers
Glenn
Re: importing a file
Posted: Fri May 28, 2010 1:12 am
by Curry
If you follow my signature consulting link to find my email...and send me your stack and the file to import, I can get the import and the column separation (your other topic) working quickly for a very small flat fee.