LAVA Forums Buy cool LAVA gear Forums RSS Feed

Welcome Guest ( Log In | Register )

> Related links

Check out our Database and File IO Code Repository Files or visit the LabVIEW Wiki Database and File IO articles.


Tags
(This content has not been tagged yet)
 
Reply to this topic Start new topic
> writing to a template file
prads
post May 29 2008, 12:55 AM
Post #1


Active
*

Member
Posts: 10
Joined: 16-May 08
Member No.: 11514
Using LabVIEW Since:2008
LV:8.5 ,8.5.1 ,.
United States Nothing Selected Nothing Selected


Hello,
I want to write text into a text template file. For example, consider I open the template file which already has the following written in it:
Name:
DOB:
Address:
Phone:

Now I have to write my name corresponding to the name field, and DOB,address,phone etc corresponding to its fields. When opened, it should look like:
Name: Prads
DOB: 10/10/2000
Address: 122 MyBlvd MyState 11111
Phone: 111-10101010

Can somebody tell me the VI's I got to use?
How should I move precisely to the position where data has to be written next. I mean, say I have written the Name and DOB, and now Iam trying to write the address......How do i jump to the location pointer corresponding to the address field. Is there a VI or an example which calculates and correspondingly ignores those text which is already present so that I can write in the required position in the file?
Thanks,
prads


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
Ad
post May 29 2008, 12:55 AM
Post #















Tags
(This content has not been tagged yet)
Go to the top of the page
Quote Post
gleichman
post May 29 2008, 03:48 AM
Post #2


Very Active
***

Member
Posts: 85
Joined: 13-August 03
From: Plymouth, Michigan
Member No.: 151
Using LabVIEW Since:1993
LV:8.6 ,8.5.1 ,8.2.1
United States us_michigan Nothing Selected


QUOTE (prads @ May 28 2008, 07:55 PM) *
Hello,
I want to write text into a text template file. For example, consider I open the template file which already has the following written in it:
Name:
DOB:
Address:
Phone:

Now I have to write my name corresponding to the name field, and DOB,address,phone etc corresponding to its fields. When opened, it should look like:
Name: Prads
DOB: 10/10/2000
Address: 122 MyBlvd MyState 11111
Phone: 111-10101010

Can somebody tell me the VI's I got to use?
How should I move precisely to the position where data has to be written next. I mean, say I have written the Name and DOB, and now Iam trying to write the address......How do i jump to the location pointer corresponding to the address field. Is there a VI or an example which calculates and correspondingly ignores those text which is already present so that I can write in the required position in the file?
Thanks,
prads



I have doubts about your question. unsure.gif You can't insert new data into the middle of an existing text file. If you want to use a text file template, you will have to read it, insert the new data (in memory) and then write it back to disk. You could use unusual characters to mark where text is to be inserted such as ASCII(255).


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
jgcode
post May 29 2008, 05:27 AM
Post #3


Very Active
***

Premium Member
Posts: 218
Joined: 1-January 08
From: Perth, Australia
Member No.: 10325
Using LabVIEW Since:2006
LV:8.5.1 ,8.6 ,.
Australia Poland Nothing Selected


QUOTE (gleichman @ May 29 2008, 11:48 AM) *
I have doubts about your question. unsure.gif You can't insert new data into the middle of an existing text file. If you want to use a text file template, you will have to read it, insert the new data (in memory) and then write it back to disk. You could use unusual characters to mark where text is to be inserted such as ASCII(255).


Yes that would be hard, but you could treat your data as arrays to overcome this.

Try this...

Attached Image


Attached File  Template_Folder.zip ( 12.08K ) Number of downloads: 47


Code is in LV8.0

--------------------
all day...


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
prads
post May 29 2008, 06:33 AM
Post #4


Active
*

Member
Posts: 10
Joined: 16-May 08
Member No.: 11514
Using LabVIEW Since:2008
LV:8.5 ,8.5.1 ,.
United States Nothing Selected Nothing Selected


QUOTE (jgcode @ May 29 2008, 12:27 AM) *
Yes that would be hard, but you could treat your data as arrays to overcome this.

Try this...

Code is in LV8.0


Oh wow the above code is excellent. However is that possible with Write to Text File.vi as well or only with Write to Spreadsheet File.vi?
Thanks,
prads

This post has been edited by prads: May 29 2008, 06:35 AM


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
jgcode
post May 29 2008, 10:01 AM
Post #5


Very Active
***

Premium Member
Posts: 218
Joined: 1-January 08
From: Perth, Australia
Member No.: 10325
Using LabVIEW Since:2006
LV:8.5.1 ,8.6 ,.
Australia Poland Nothing Selected


QUOTE (prads @ May 29 2008, 02:33 PM) *
Oh wow the above code is excellent. However is that possible with Write to Text File.vi as well or only with Write to Spreadsheet File.vi?
Thanks,
prads


No worries
Write to Spreadesheet uses the native Write to Text File VIs so yes....go for it! smile.gif

--------------------
all day...


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
prads
post May 29 2008, 09:23 PM
Post #6


Active
*

Member
Posts: 10
Joined: 16-May 08
Member No.: 11514
Using LabVIEW Since:2008
LV:8.5 ,8.5.1 ,.
United States Nothing Selected Nothing Selected


QUOTE (jgcode @ May 29 2008, 05:01 AM) *
No worries
Write to Spreadesheet uses the native Write to Text File VIs so yes....go for it! smile.gif


Hi,
I have another small problem. In my implementation, the data file is a 1D array of string and the template is a 1D array of string. However when I use the build array.vi it still produces 1D array of string. Now the output of the build array does not let me connect to the Write to Spreadsheet File.vi's 2D input. So when I check the data.csv output file after running the code, it shows me my template completely first and then my input data. Somebody please help.
regards,
prads


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post
orko
post May 30 2008, 11:05 PM
Post #7


Extremely Active
****

Premium Member
Posts: 535
Joined: 18-October 05
From: Seattle, WA
Member No.: 3266
Using LabVIEW Since:2005
LV:8.6 ,8.5.1 ,7.1.1
United States us_washington Nothing Selected My Blog


I would highly suggest looking at the context help window for your answer (concatenate inputs option). It will feed you for a lifetime wink.gif

--------------------


Tags
(This content has not been tagged yet)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic

 




Time is now: 4th December 2008 - 07:26 AM