10-16-2023 12:35 PM
Hi Hope all is well, I was trying to format data in xml and failed due to labview version conflict (couldnt get easy xml to work in 2013), so tried to format the data in json. It seems to be ok apart from changes i have to make to the output which went ok apart from when i was trying to delete index numbers that were being generated from the cluster.
in the above for example "4": (there are 21 generated i need to delete)
i have tried various for and while trials , but only ever manage to delete the last number created from the loop.
i'm trying to use the count to concatenate with the other parts of the string to change the generated json file for each item i want to delete, i have also noticed that from the results on the concantenated string indicator that it is not counting sequentially and some some counts +2 instead of 1.
If some someone could take the time to tell me what i'm doing wrong it would be greatly appreciated.
regards
Solved! Go to Solution.
10-16-2023 01:44 PM
Just noticed i had wired up the loop iteration instead of a constant of 1 to count up, while loop looks to be ok still cant delete all the indexes except last one....
10-16-2023 01:47 PM
You need a shift register for your string, just like you did for the numeric.
10-16-2023 01:49 PM
Thanks for the reply zou, i was watching the data there highlighted and noticed its deleting the index number then replacing it again, ill have another look
thanks
10-16-2023 01:59 PM
Nicely spotted zou, i was going round in circles there. I just need to delete the 0: from the list and i think that's it.
many thanks
10-16-2023 02:10 PM
That seems to be what i'm looking for, thanks again for your help zou, possibly not a vi for the purists but there we go, if anyone can let me know if there's a cleaner way i'd be more than interested.
10-16-2023 02:30 PM
1. Plus 1 after format into string, then you don't need delete 0 after while loop;
2. If you only need run 20 times, use a FOR loop instead of while loop;
3. Use the loop index instead of the numeric shift register.
10-16-2023 02:48 PM
Thanks for the tips and feedback zou, that looks a lot cleaner and easier to maintain, its just about 20 measurement entries just now, that may go up. ill try and have a go at counting the clusters and automate it a bit more and using that for the for loop count. Makes a bit more sense now with using loops to, nicely explained