Sign in to follow this  
montyk

One Page to Display Multiple Units

Recommended Posts

I have an applictation were I am reading data from 16 different units but the screens are exactly the same.

Is there a way I can use one screen for all 16 units istead of copy the page 16 different times. :blink:

Share this post


Link to post
Share on other sites

There are several ways of doing this. The easiest way is probably using evaluate():

1) create your channels for each unit, ending the channel name with the number of the unit. Something like this if you had two channels for each unit:

mychannel1

myotherchannel1

mychannel2

myotherchannel2

etc.

2) create a global variable called displayedunit and init it to 1

3) create your screen, but anywhere you would normally put mychannel1[0] replace with:

evaluate("mychannel" + doubletostr(displayedunit) + "[0]")

really, you are taking the entire expression and just substituting the global. Its even easier if you make displayedunit a string variable, say "1" or "2" instead of number, then its just:

evaluate("mychannel" + displayedunit + "[0]")

If you have something more complex, like math, do:

evaluate("mychannel" + displayedunit + "[0] * pi() / 180")

4) finally, just change displayedunit to change which unit is displayed.

Note that this only works for display. If you have output channels you need to use the Quick Sequence action and execute() instead of evaluate().

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this