LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatic read access to project symbols

Hi,
 
I'm wondering if there's a way to achieve programmatic way to achieve a read access to the symbols defined within a project apart from the conditional disable structure? I have tried access via VI server, but haven't succeeded  
I'm (still Smiley Wink ) using 8.20.
For me, it would be a nice way of passing certain enviroment settings....
 
Thanks a lot!
 
Oli
 
0 Kudos
Message 1 of 17
(7,866 Views)
The first idea that comes to mind would be to read the project file itself, which is just XML. The following lines can be found for two custom symbols I created in a project:

<Property Name="CCSymbols" Type="Str">mySymbol,TRUE;yourSymbol,FALSE;</Property>


Which of course corresponds to:
Property:      Symbol:
mySymbol       TRUE
yourSymbol     FALSE

The key thing to look for is the "CCSymbols". Honestly not sure if there's another way, but this way might only give you custom symbols, not built-in stuff like TARGET_OS or whatever. Just a guess...

Jarrod S.
National Instruments
Message 2 of 17
(7,860 Views)

Hi Jarrod,

thank you very much.

For the tasks that I intended to do, this solution is a bit too complex, I'll try a workaround. But still I hope, a read access will be possible on day (can we put that on the wishlist for 8.3 or whatever comes next? Smiley Wink )

 

Cheers

Oli

0 Kudos
Message 3 of 17
(7,843 Views)

What symbols are y'all talking about?

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 17
(7,842 Views)
We're talking about the (conditional disable) symbols you can define in LV-project files which I tried to "recycle" for other tasks Smiley Happy
 
0 Kudos
Message 5 of 17
(7,834 Views)

I know this is an old thread, but I'm betting that more people will want to know how to do this, and it's not all that intuitive.  I wrote a VI that gets symbols for the project itself, or for a target within the project, including "My Computer."  I haven't written a VI to set symbols yet, but it's the same idea except that you'd use the "Set Tag" method instead of "Get Tag."

 

This one is in LabVIEW 8.6.1, just because that's what I'm using today.  (Sorry, no LabVIEW 2009 snippet)  Smiley Wink

 

Jim

Message 6 of 17
(7,522 Views)

Just an update in case anyone ever wants to do this again:  (might as well store my notes here!)

 

The location of the CCSymbols tag changed at some point.  It's no longer a tag of the "My Computer" target; it's a tag of the project "root".

 

I'm using LabVIEW 2012, and here's what I discovered:

 

  1. Get the project reference by various means
  2. Use a property node to get the "Root" property.
  3. Use an invoke node to call the methods, "Get Tag" or "Set Tag".  For "Tag Name", specify "CCSymbols."
  4. Parse delimited string stored in the variant

Like so:

CCSymbols.png

 

It can be done!

 

Some might ask, "Why on earth would you want to do this?"  Well, in my case, I'm using the project API to automate setting of symbols before I run a build spec.  I've got different options I compile with, depending on how I'm using my application.

 

Have fun.

 

Mr. Jim

Message 7 of 17
(7,022 Views)

There are two locations for CCSymbols. One is the project root, the other is a target (as "My Computer"). When a symbol is defined in both locations the one in the target wins.

 

I recomend to use the new property "Owning Project" instead of "Active Project". (The Active Project can be a different one than the one the VI is inside.) (For LabVIEW 2012 and before I use "TargetItem" and then its property "Project". This returns the same as the new property.)

Message 8 of 17
(6,911 Views)

Thanks for the clarifications, shb!  Next time I implement this I'll use your methods, since you seem to have explored further than I did.

0 Kudos
Message 9 of 17
(6,904 Views)

I found some VIs from NI:

 

<LabVIEW>\resource\plugins\Utility\IfDef.llb\GetSymbols.vi

<LabVIEW>\resource\plugins\Utility\IfDef.llb\SetSymbols.vi

 

They exist at least since LabVIEW 8.6

 

Set the reference to Project.Root for conditional disable symbols of the project.

Set the reference to a target (often MyComputer) for conditional disable symbols of this target.

 

Message 10 of 17
(6,854 Views)