Jump to content

writing to a template file


Recommended Posts

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

Link to comment

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: 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).

Link to comment

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

Link to comment

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! :)

Link to comment

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! :)

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

Link to comment

Hello,

I have a topic running in the path LAVA > Software & Hardware Discussions > LabVIEW (By Category) > Database and File IO.

I started it in LabVIEW General section but perhaps the moderator moved me there. Nobody is answering my question in that section so i am posting it here again. Please excuse me.

Please refer to the post "Writing to a template file" in the above section.

Now that you know the status, here's my problem:

I have used the same concept as in the example posted by jgcode.

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.