data inputs from .Dat file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 19
- Joined: Fri Feb 19, 2016 7:48 am
data inputs from .Dat file
I am working on a project that needs data to be entered by the outsource like .Dat file. i am unable to find anything suitable for this..
plss help me out with some hint in the coding.
plss help me out with some hint in the coding.
Re: data inputs from .Dat file
Hi Shikha,
Take a look at this;
http://lessons.livecode.com/m/4071/l/96 ... -text-file
Now that's a text file, a binary file is similar.
Simon
Take a look at this;
http://lessons.livecode.com/m/4071/l/96 ... -text-file
Now that's a text file, a binary file is similar.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 19
- Joined: Fri Feb 19, 2016 7:48 am
Re: data inputs from .Dat file
I am trying to make something that will work as real time. when i will open it, it will update the data automatically and provide me with the recent data. hence for this file m starting with the fetching of information from dat file or a text file and deal with that. the information shared with me above is all about importing a text file but i want to import the data in a file and updating the last data with respect to imported data.
Re: data inputs from .Dat file
While there is an "answer file" do you see how later on it has the "put URL..."but i want to import the data in a file and updating the last data with respect to imported data.
With the "put URL" if you already know the file location then you don't need the "answer file".
So you do the "put URL..." into a variable then update the variable and use "put myVar into URL..." back into the text file, similar format as when you load the file.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 19
- Joined: Fri Feb 19, 2016 7:48 am
Re: data inputs from .Dat file
Thank you for your advice.
I have a text file named "abc.txt" in my Local disk, i tried "read from....", "get URL..." , "Put URL..." command to get data from my text file and put it into a field.
i guess as i am new to liveCode i couldn't be able to use these command rightly into the code form.
Will you guide me in proper form to use these commands so that it will work. I tried but nothing happened, no data is fetched from text file and displayed in the field....
I have a text file named "abc.txt" in my Local disk, i tried "read from....", "get URL..." , "Put URL..." command to get data from my text file and put it into a field.
i guess as i am new to liveCode i couldn't be able to use these command rightly into the code form.
Will you guide me in proper form to use these commands so that it will work. I tried but nothing happened, no data is fetched from text file and displayed in the field....
Re: data inputs from .Dat file
Hi Shikha,
From the lesson;
One of the things that often happens is people get the path to the file incorrect. That "answer file" ensures the path is right.
I suggest you use this to method just to get the path, it will end up in the "it" variable which then gets put into theFilePath variable. Throw a breakpoint in and copy theFilePath. Put copied text into
Now you can delete the answer file stuff and you should be good to go.
Simon
From the lesson;
Code: Select all
on mouseUp
answer file "A text file"
if it <> "" then
put it into theFilePath
put URL ("file:" & theFilePath) into field "text"
else
--no file was selected, or cancel was pressed
beep
end if
end mouseUp
I suggest you use this to method just to get the path, it will end up in the "it" variable which then gets put into theFilePath variable. Throw a breakpoint in and copy theFilePath. Put copied text into
Code: Select all
put URL ("file:c://the copied text/whatever/mytext.txt") into field "text"
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 19
- Joined: Fri Feb 19, 2016 7:48 am
Re: data inputs from .Dat file
Thank you Simon. I am really grateful as i found the way as per u told.
Now i tried some experiments over the code u provided. I added some more codes and try to read a particular data from a text file, but i am unable to perform accurately i willing to do. firstly i tried to use the "read from..." command and read my text from start to the point i mentioned, i succeeded. But when i tried using it like i want to read it from after the space i am unable to do so.
it is returning me the file path but not with the text.
how can i read my text in the field from a particular point till a point
Now i tried some experiments over the code u provided. I added some more codes and try to read a particular data from a text file, but i am unable to perform accurately i willing to do. firstly i tried to use the "read from..." command and read my text from start to the point i mentioned, i succeeded. But when i tried using it like i want to read it from after the space i am unable to do so.
Code: Select all
read from file theFilePath at " "
it is returning me the file path but not with the text.
how can i read my text in the field from a particular point till a point
Re: data inputs from .Dat file
Hi Shikha,
If you could post the text you are trying to read, we might be able to help you find a better way.
Maybe just a portion of it, but tell us which part you want.
Simon
If you could post the text you are trying to read, we might be able to help you find a better way.
Maybe just a portion of it, but tell us which part you want.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 19
- Joined: Fri Feb 19, 2016 7:48 am
Re: data inputs from .Dat file
I need to read the word till the "|" and put it in the specific field.Calls | Agents | rest time | Talk time
25 | 5 | 0:15:25 | 0:59:45
For example: i have four fields namely- field 1, field 2, field 3 and field 4 now,
in field 1 i want the data "Calls" to be printed,
in field 2 i want "agents" to be printed .
in field 3 i want "rest time".....and so on
through this it will be like whenever the text file is updated the field will be updated accordingly.
i guess it be done with the "read from..." command but unable to find the proper way.
Re: data inputs from .Dat file
Hi Shikha,
After you have imported the text file via "put URL..."
Use
Then each of the items can be selected by
I rarely use "read from"
If there are multiple lines, something I've never tried
But I think it would work.
The important thing here is the "set itemDelimiter"
And I think the world likes tab over pipe (|) so if you can change that, cool.
Simon
After you have imported the text file via "put URL..."
Use
Code: Select all
set itemDelimiter to "|"
Code: Select all
put item 1 of myVar into tItem1--... etc.
If there are multiple lines, something I've never tried
Code: Select all
put item 1 of line 5 of myVar into tItem15
The important thing here is the "set itemDelimiter"
And I think the world likes tab over pipe (|) so if you can change that, cool.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 19
- Joined: Fri Feb 19, 2016 7:48 am
Re: data inputs from .Dat file
Thanks Simon.
I myself now think it's the best way out. It will definitely gonna work accordingly as per i required.
Shikha
I myself now think it's the best way out. It will definitely gonna work accordingly as per i required.
Shikha