09-23-2011 02:14 AM
Hi!
I have a problem that I would get very happy if someone could help me with.
I have a 2D array of strings. The first row is headlines (e.g. Number, Date, etc.) for the information kept in each column.
Ex.
No. Date Information .....
1 2011-05-23 Something .....
2 2010-10-14 Something else .....
3 2011-07-24 Blaha .....
Etc.
The thing is that I want to combine the headlines with the data in every row (for one row at the time) and send it out as an string.
Ex.
String 1:
No: 1
Date: 2011-05-23
Information: Something
.....
String 2:
No: 2
Date: 2010-10-14
Information: Something else
.....
Each string will be sent as a email. The emailing part is solved but I can't get the format of the strings to look good.
I am kind of new to Labview and don't really understand everything about it but in an other language I would have done two loops, one looping the rows and one inside the other looping the columns, but how much I try I can't get it to work in Labview. Can someone please show me how to do this?
09-23-2011 02:39 AM
09-23-2011 02:43 AM
You can basically do it like you want to. Use a Split Array at 1st row and send both parts to 2 nested for loops. The 1st row should have Autoindex disabled on outer loop. In the inner loop you should then have column names and column values which can be built into a string.
I'd let it build arrays and add a Concatenate strings to the result.
/Y
09-23-2011 02:49 AM
09-23-2011 03:34 AM
Thank you very much for the solution! Something I have understood while trying to learn Labview is that the solution is often much simpler then you think 😃
But I have one more question. This solution is perfect for this specific problem but what if the headlines of the array don't have the same index every time I want to run the program? I might want to use it for an other array without changing size and format of the VIs. Is there a good solution for this?
09-23-2011 05:55 AM
@Gerd nice one! 😄
Tokmas, then you make the index a control so you can decide it each time you run it.
/Y