Descriptive text component text field


Recommended Posts

the descriptive text holds a 2 alpha character site id for 16 sites and I was hoping to use it for channels names

example

NB_Pressure_Reading

CB_Pressure_Reading

etc

I was hoping to use the evaluate function to generate the Channel names 

 

Link to comment
Share on other sites

I have decided to use a sequence with a switch statement to populate the site ID by trying to follow the Manual section 5.13 and section 5.10 re variables but I cannot get it to compile

please see attached

what have I done wrong?

 

Site-Seq.PNG

Link to comment
Share on other sites

= is assign, where == is comparison.  So, you really should never use = inside an if(), or even a while() loop or anywhere else where you are comparing two values.

Also, I'd use a lookup table for this:

global string sites
sites[0] = "BB"
sites[1] = "CB"
// etc

then you can just look it up using:

sites[site_ID]

and it will return the correct string provided the ID is valid.

 

Link to comment
Share on other sites

You don't have to use a lookup table.  Do what's comfortable to you until performance becomes an issue.  And most DAQFactory user's aren't programmers either, though many of them learn to program using DAQFactory and thus add a powerful tool to their toolkit.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.