06-23-2009 04:52 AM
Hi,
Can someone give me a hint about how to dynamically create variable in LV?
I'd like to have a VI which will load whole *.ini file and respectively create global variables with initialisation:
*.ini LV Variables
[Variables]
Var1=5 ---> Var1 = 5
Var2="werwer" ---> Var2 = "werwer"
Var3="false" ---> Var3 = "false"
Many thanks in advance.
06-23-2009 05:54 AM
If you know ahead of time the structure of the Cluster then This Nugget on Control references may help. This image is a preview.
If you do not know the cluster structure you will have to use scriting to create the cluster.
Ben
06-26-2009 11:56 AM
Hi MimiKLM
I hope you're having a good day. Take a look at this link to the Developer Zone, I think it may be helpful for you:
http://sine.ni.com/devzone/cda/epd/p/id/993
There is also another forum thread that discusses creating shared variables programmatically:
http://forums.ni.com/ni/board/message?board.id=170&message.id=200742&requireLogin=False
I hope this helps!
Kind Regards
06-26-2009 02:17 PM
I don't think creating shared variables on the fly is very appropriate if you just want to store configuration settings stored in an ini file.
I would consider searching the forums for the term functional global, which is a VI that stores user-configurable data that can be accessed globally in your application. Your functional global could be designed to read and parse the ini file settings, and then allow access to arbitrary settings based on their key name.
06-26-2009 02:49 PM
Jarrod S. wrote:...
I would consider searching the forums for the term functional global, ...
I'm on the same page... so much so that included in the example code in the Nugget I sited above, you will find an Action Engine (Functional Global) included. Theoretically all you have to do to my example is replace my type-def with your cluster and you are good to go (provided you did not use a data type that I did not code up).
Ben