LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combine data from array

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?

 

 

 

0 Kudos
Message 1 of 6
(2,502 Views)

Hi Tokmas,

 

as simple as it is:

check.png

Best regards,
GerdW


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

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(2,497 Views)

To include Yamaedas comments:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(2,495 Views)

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? 

0 Kudos
Message 5 of 6
(2,492 Views)

@Gerd nice one! 😄

 

Tokmas, then you make the index a control so you can decide it each time you run it.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(2,482 Views)