LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need a VI without a path terminal that saves text in file.

Solved!
Go to solution

I need a small VI with three terminals that stores log-information in a file. Terminals: Error IN/OUT and string input.
However, the VI must have information about where to store the file and the filename. In what way can that be done and still only have three terminals?

 

WIth my level of experiance I can think of 3-4 ways.

 

1. Each time this small log-VI are called it reads path info from a INI-file.

2. The VI has a path-const. 

3. Global variable

 

4?  The first time VI are called it reads the path from the INI-file. The VI are mem-persistent so it never lose the path information. 

I do not know how or if it is possible to have the VI to work like this.

 

Please advice, thanks.

 

0 Kudos
Message 1 of 7
(1,374 Views)
Solution
Accepted by topic author TakeANap

I think an "Action Engine" could work for #4.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(1,344 Views)

AE is definitely something I will study more. Thanx.

0 Kudos
Message 3 of 7
(1,323 Views)

Yes, there are plenty of solutions, but you need to make it fail-safe. For example if it reads the path from the ini file and the ini file or path entry does not exists for some reason, it should pop a file dialog on first call, verify the entry to make sure the location is writeable, then create or update the ini file.

 

If you decide to use a path diagram constant, make sure to make it relative to a defined folder (e.g. "user home" or similar). so it will continue to work, even if run on a machine with a different OS or different file layout.

0 Kudos
Message 4 of 7
(1,310 Views)

I like the VI that returns "My Documents" path. From that point, I use a relative path or simply save the log-file in My Docs. 

I have also a check that the string having only printable chars and length are less then 256.

 

 

0 Kudos
Message 5 of 7
(1,280 Views)

@TakeANap wrote:

I like the VI that returns "My Documents" path. From that point, I use a relative path or simply save the log-file in My Docs.


I tend to save everything in the "Public Documents" folder.  That way, any user can access the data.


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 6 of 7
(1,243 Views)

I almost have a event-structure in my applications. Why not place the log-VI in a case that gets activated if a string-ctrl gets updated? I can then have a path as terminal from the "read-INI" file becuse I only need to have one copy of the log-via and that is inside the event-case.

In the application, I use a local-var to write to the string that activates the event.

 

"Things can be done in hundred ways". 

 

0 Kudos
Message 7 of 7
(1,223 Views)