@crossrulz wrote:
So for some reason, I have had this thread in my head since last night. And I think I have come to the conclusion that I would attack this with 2 FOR loops. Each loop can run in parallel, each handling a different line in the final file. I would use an array of strings to state what is being handled for each item going into the line. Autoindex on those arrays and do whatever parsing, etc needs to be done inside of a case structure, and autoindex a string out of the loops. At this point, a FOR loop will output an array of strings. You then use Array To Spreadsheet String to convert into a comma delimited array and write the string.
I felt the need (and found the time) to create an example. The VI is saved in 2018 for you.
Notes:
- Notice on the case structures that I enabled the Case Insensitive Match (right-click menu option) so you don't really have to worry about capitalization issues. It is a slight performance hit, but I find it worth it.
- I would turn each of those loop setups into their own VIs to help break up the code into more testable components. For the testability, I would have the loop and its controlling array constant in the subVI, outputting an array of items going into the line. It is easier to read, and therefore easier to debug, an array of strings than a comma delimited string.
- I barely started with what I could quickly (ie <30 seconds) decipher from your VI (boy is that a string concatenation mess). There is a lot of work to be done to clean this up.
- Instead of an array of strings, you could use an array of Enums to define your case structure. Have a look at the Natt Sequence for another alternative.
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