LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in saving data

Hi im trying to save the translations I input in this VI into a text file, it works fine and saves the translations even if I press stop. My problem here is that when I exit LabVIEW and close the VI entireley the saved data is gone and I have to input the translations again. Help 😐

0 Kudos
Message 1 of 19
(2,631 Views)

Can you post your vi in version older than LV 9.0 or post a snapshot? Are you creating the text file to save the translation and it is being erased when you exit the labview? If it is something like a text control input and then all you have to do is, set it as default and next time you open the labview it ll still be there. 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 2 of 19
(2,627 Views)

You never close the file.

 

How are you stopping the program? The Stop button is not wired to anything and the Panel Close? event does nothing.

 

Lynn

0 Kudos
Message 3 of 19
(2,621 Views)

I dont have any older versions but heres the snapshot. tnx

Download All
0 Kudos
Message 4 of 19
(2,620 Views)

Hi Mark,

 

I see some problems in your VI:

- you load your file at first using an array of I16 as type input for conversion to variant.

- then you add a lot of translations as strings - is this wanted this way as the file seems to consist of [I16]?

- after adding a translation you save a serialized string of your variant to the file,. This adds the full variant to the end of the file! Each time! So your file contains a lot of variants (as serialized string) and you probably only load the first of them at VI start...

- using text file functions for binary strings (as given by Serialize function) seems wrong to me...

 

Edited:

Why not store all those translations in spreadsheet files using simple 2D array of strings?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 19
(2,619 Views)

johnsold,

 

the stop button just got covered by the event structure, its in the back. Just click the stop button in the FP and find terminal you'll see its covered. sorry about that XD

0 Kudos
Message 6 of 19
(2,618 Views)

GerdW

 

what input type should I use?

0 Kudos
Message 7 of 19
(2,606 Views)

Hi Mark,

 

I don't know the correct input type as I don't know your file. See comment above!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 19
(2,604 Views)

Im not really that familiar with the spreadsheet string you mentioned. Im quite new in LabVIEW. So I had to stick with this.

I managed to change the read/write text files to read/write binary files. does that lessen the errors I have?

0 Kudos
Message 9 of 19
(2,599 Views)

@MarkBai wrote:

Im not really that familiar with the spreadsheet string you mentioned. Im quite new in LabVIEW. So I had to stick with this.

I managed to change the read/write text files to read/write binary files. does that lessen the errors I have?


Is that you really want? Be clear If you write to a binary file you cannot open that manually. You can use the simple Spreadsheet write.vi to write string and Numeric arrays into it. You can find examples in LabVIEW example or use a simple text file and set the file position to write multiple times.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 10 of 19
(2,588 Views)