LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Report" versus "File"?

I have a program that runs a large HVAC unit for a long period of time. I would like to keep track of simple data during this run, such as time of switch setting changes, temperatures at different points of time, time of faults, etc. No fancy analog data is being monitored. I would like this data to be stored to a file where this data may be uploaded again if need be (if they need to re-run the unit for example and need to know how much time it has already run) or sent to a printer.

Looking through the available tools in LabView 7.1 I see both "reports" and "files". Which of these options is better suited to what I am trying to accomplish? Btw - I am a self-taught beginner, so speak s-l-o-w-l-y! 🙂
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 1 of 26
(2,942 Views)
Spif,

The difference between the two is how they are used. I always think of a report as something to hand to the boss that looks pretty and says see I did get something done. The report is the final polished type thing, and in general is never used to get data from. You would not reload a report.

A file on the other hand is everything else. You have complete control over what you put in it, how it looks, and how you store it. This is what you are looking for. In the file you can save all the state changes and data points. You can then read that back in and view it. I would suggest starting with an Ascii text file, unless it is going to be a huge file. My main reason is it is easier to look at the text file and figure out any mistakes you have made. Trying to read a binary file is a good way to cross your eyes.

Now with that being said you mentioned printing. Depends on the use case, if it is for a tech to see what has happened stick with a text file. If it needs to look nice, then I would create a program that can read your data text file and turn it into a report.

In all honesty you can make your text file look nice, so unless you need graphs and images in the printout stick with text files.
Message 2 of 26
(2,926 Views)
Okay, I set up a simple new file procedure and it's not working right. I put in an "Open/Create/Replace File" tool in my program, wired a 2 to the "function" (tells the tool to create a new file or replace an existing file) and wired a string value to the "default name". All other inputs I left default. The next tool I placed was the "Write File" tool and I just wired the refnum and error out from the previous tool into the "Write File" tool and I also wired a test string into the "data".

When I run the program, a pop up window comes up prompting me to enter the name of the file to "Save as". This pop-up window continues to come up, regardless of what I enter and I can't get out of the loop. Why does it not seem to accept the name of the new file and keep prompting me to re-enter it?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 3 of 26
(2,898 Views)
You need to wire in a file path to the "File path" terminal. If the path is empty, by default, then you will get the file dialog. Since you are doing this in a loop I would suggest adding a shift register to the loop, and pass the file path through the shift register. In addition wire a empty file path constant to the shift register on the outside of the loop. What this does is pop the dialog a single time, and then from that point on it will use the file you selected.


However, you selected option 2, which means it will replace the file every iteration. So the above will simply replace the file every time through the loop. If you want to append data I would use Option 1 open or create. If you attach a sample of what you are trying and what you want the file to look like we can help you.
Message 4 of 26
(2,882 Views)
Pass the file path through a shift register or pass the refnum? Or pass both?
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 5 of 26
(2,873 Views)
Here is an example with what I would do. The VI does not run it is just an example

Notice that I am passing the refnum around, instead of the path. The reason is that I have moved the open out of the loop. In general you want to open and close a file a single time. It is suggested that you open before the loop, then do anything you want in the loop, and then close the file out of the loop.

In this example you would get prompted at the start of the VI and never again.
Message 6 of 26
(2,868 Views)
I found the solution to my previous problem. I had the "Open file" tool placed inside a stacked case structure that continued to loop (this case repeats itself while it waits on an operator to select a push button).

Now I have my logic set up pretty much like yours, but when I added a path name constant to the path name it no longer created anything! This file stuff is rather annoying. All I want to do is create a new file, and continue to append new data to it as my project runs. If I leave the path name blank so it prompts me to "save as", it will create the file, but only put in the first line.

I'll try to paste some sample code, but my program is pretty large and the file write tools are placed in different cases in my stacked case structure.
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 7 of 26
(2,864 Views)
Feel free to attach the VI and I will take a look at it.

A fresh set of eyes may help.
Message 8 of 26
(2,861 Views)
Got some proprietary stuff in here, so I'll have to pretty it up a bit!
********************************************
Amateur programmer for over 10 years!
********************************************
0 Kudos
Message 9 of 26
(2,860 Views)
I was thinking about it and came up with the following example.

As long as you don't use the position terminals it should append like you want. However if you are using the position terminals you can make it only save one line. So see if you are wiring anything to the write file other than refnum, error, and data.
Message 10 of 26
(2,850 Views)