LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String format

Hi

 

i have a problem with formatting.

 

I am loading data from a text file (lvm) delete the section i dont want and then save it back off.

 

I am losing the formatting when i am changing from a string to array and back again (or this is where i think the problem is).

 

I've included two files so you can see what i mean.

 

Database121 Before is the original layout and how data is saved.

Database121 After is with the section i dont want deleted. You can see i've delete 54321/1 and added the new data to the end of the file.

 

How can i get the formatting to stay the same? I need to have the /(number) in there and also 'FAIL' and date etc...

 

Please help!

 

 

Download All
0 Kudos
Message 1 of 26
(3,517 Views)

Hi!

 

You should read, change and write it all as string. You convert with with the "Spreadsheet to array". It converts all the data into doubles which have six digits after ".". Therefore you need to put an empty string into the "Spreadsheet to array" to keep the data as string. Like this:

adsa.PNG 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 2 of 26
(3,509 Views)

Thanks,

 

that worked as far as the formatting goes, but now it doesn't put it in the correct place...any ideas?

0 Kudos
Message 3 of 26
(3,503 Views)

I guess your 2D array needs to be transposed:

adsa.PNG 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 4 of 26
(3,495 Views)

hmmm, i'm not so sure.

 

If i put the file position before writing as current or end it says it correctly but keeps the old data in the file.

If i set it to start it doesn't do it correctly.....hmmm

0 Kudos
Message 5 of 26
(3,491 Views)

How are you opening the file? Is the 'operation' set to 'open' or 'replace'?

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 6 of 26
(3,488 Views)

Hi,

 

its set to open or create....

0 Kudos
Message 7 of 26
(3,483 Views)

This option will add data to the existing data in the file. Try setting it to 'replace' and see if you get your result. Else, let us know and we will see what can be done. Also, if the issue persists, try posting the code so that we can try fidelling with it, before we suggest the solution.

 

N.B: I use LV2010SP1

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 8 of 26
(3,478 Views)

Thanks for the sugestion.

 

When i set it to replace the file has nothing except my ammended data. None of the other data i want to keep.

 

If i set to replace or open i now get this.

 

It has deleted and replaced 54321/4 with new data at the end.

 

The problem is the duplicate of the other data......

 

 

0 Kudos
Message 9 of 26
(3,472 Views)

@DelEngUK wrote:

 

If i set to replace or open i now get this.

 

It has deleted and replaced 54321/4 with new data at the end.

 

The problem is the duplicate of the other data......

 

 


I did not understand 'duplicate of other data'.

 

Edit: Could you post your code, so that I can look into it? What is it that the file should look like after you make the changes to the data?

 

Regards
Freelance_LV
TestAutomation Consultant
0 Kudos
Message 10 of 26
(3,469 Views)