LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Save to Text File with Save Button possible?

Solved!
Go to solution

So I've figured out how to implement the Write to Text File function easily enough. With that I input some words into the input-string and when I run the program it creates a new text file in the location I want with the wording from the string in that file.

 

But...

 

I have to keep stopping and starting the program if I want to input anything else to that same input-string. I want the program to be able to keep running and when I type more into that input-string (while running) the program can save my new entry into the already created text file with some Save button or whatnot. The best I've found is a function that saves data to a spreadsheet. I feel like this is an easy fix.

0 Kudos
Message 1 of 13
(4,007 Views)

Please supply some code so we can see what your current architecture looks like.  Then we can make better suggestions.

 

But off the top of my head:

1. You will want to keep the file open as long as you could possibly be writing to it.  This usually means open/create the file at the start of the application and close it at the end.  Save the reference in a shift register.

2. The Save button can be done with either an Event Structure or a Case Structure.  Which one is better for your situation would depend on your architecture.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 13
(4,000 Views)

Yes, it is easily possible. Show us the code you have so far.

 

0 Kudos
Message 3 of 13
(3,997 Views)
0 Kudos
Message 4 of 13
(3,966 Views)

@ShogunOrta wrote:

Here you go.


Where is the code that you want to build the text data from?  Where is your loop?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 13
(3,961 Views)

I haven't implemented anything for the Save Button element. This is just the code I have for the basic file creation. I don't need you guys to come up with the button code. Just a suggestion or two would be helpful.

0 Kudos
Message 6 of 13
(3,952 Views)

@ShogunOrta wrote:

Just a suggestion or two would be helpful.


Then go back and read my first post in this thread.  Without more information, that is the best advice you are going to get.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 13
(3,944 Views)

Oh.... You did give me a suggestion. Sorry about that! Guess I was scrolling too quickly and missed your post. Thanks, I'll get on that!

0 Kudos
Message 8 of 13
(3,938 Views)

Okay, here you go again. This time it's using an Event Structure. But alas, still no dice.

0 Kudos
Message 9 of 13
(3,922 Views)

Hi Orta,

 

But alas, still no dice.

Your VI is writing the "string 10" value to a file in several events.

What is the purpose of have 3 events all used to write string data to a file? The only difference is the file open mode…

What should happen in "Create" event? What should happen in the other two events?

 

You also forgot to implement atleast the simplest error handling!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(3,893 Views)