SAPHIR - Toolkits Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Question for GDatabase in labview

Solved!
Go to solution

I want to read the field names in the mySQL database, then use these names for writing to the database. However, the INSERT-block in labview requires a cluster of data as input and the cluster names cannot be changed during run-time. My question is: Is there any way that labview can read the number of fields and their names and then write data to these fields in the database? Or do I have to hard code the structure of the database before running Labview?

The best I can do at the moment is to compare the names and issue a warning if names in labview doesn't correspond to the field names in the database table. If anyone knows a better way around this, please let me know.

Kind Regards,

Jonatan Tidare

0 Kudos
Message 1 of 6
(6,780 Views)

Hello Jonatan,

Could you please tell us more about the final use case of your question? It seems that you want to avoid hard-coding in LabVIEW. Why? Because your DB structure is going to change a lot or for other reasons?

Olivier


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn |

Stop writing your LabVIEW code documentation, use Antidoc!
0 Kudos
Message 2 of 6
(6,351 Views)

The goal of the full project is to monitor multiple physiological parameters and send them to the mySQL database through a stream. The sensor units will stream through bluetooth to labview and labview will then write the data to the server. It is likely that the number of sensors will change during the development of the project and it would be convenient if labview could match inparameters with database fields in run-time instead of reprogramming when we change sensors. For the end product, the database structure will most likely be unchanged and hard coding can be done. I just wondered if there is a way to match sensor data with table fields online.

Kind Regards,

Jonatan Tidare

0 Kudos
Message 3 of 6
(6,351 Views)
Solution
Accepted by topic author jonatantidare

As far as I understand, I'd probably focus the effort on the DB conception and SQL queries. I'd make a DB with 3 tables (for example SENSOR (Id, Name, other relevant data),DATA (Sensor_Id, Test_Id, Value, Timestamp) and TEST (Id, Measurment_Id, other relevant data). With these tables you'd be able to manage in LabVIEW as many sensors you want without hard coding or change in your program.


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn |

Stop writing your LabVIEW code documentation, use Antidoc!
0 Kudos
Message 4 of 6
(6,351 Views)

Very good tip, thank you. I think we'll use this solution until the final structure of the database is set.

Kind Regards,

Jonatan Tidare

0 Kudos
Message 5 of 6
(6,351 Views)

Glad to be helpful


Olivier Jourdan

Wovalab founder | DQMH Consortium board member | LinkedIn |

Stop writing your LabVIEW code documentation, use Antidoc!
0 Kudos
Message 6 of 6
(6,351 Views)