Jump to content

IF Statements in Data Tags


Recommended Posts

I would like to create a Data Tag that shows an Arrow in 1 of four different directions. I am aware that IF statements are available in Data Tags and so far I have come up with this String that will do what you see in the image below.

 

⇧@#Lighting Device#.#Pan#<90:⇩

 

169261941_Screenshot2022-12-17at15_36_25.thumb.png.e98208b63dae5342a20b3fae55157930.png

 

However, I have drawn a blank when it comes to creating ranges of values. For instance I would like an:

 

  1. Up Arrow when Pan angle is between 45 and -45
  2. Left Arrow when Pan angle is between 45 and 135
  3. DOWN Arrow when Pan angle is between 135 and 225
  4. RIGHT Arrow when the Pan angle is between 225 and 315

 

I have figured out that I will possibly need 4 text blocks in the Data Tag but ulimately it would be great to learn how to create this string with one Text block if possible.

Any help with this conundrum would be greatly appreciated.

 

As a sidebar, I have noticed that the Greater than ">" and Less than"<" math symbols seem to be behaving the wrong way around in Data Tags. This is probably my stupidity, but it certainly tripped me up while doing this.....

Direction Data Tags.vwx

Edited by markdd
  • Love 1
Link to comment
  • 8 months later...

@markdd

I know an easy way to do this:

Since Vectorworks 2022 you can use worksheet functions within the data tag. In this case I would go with the function IFS, because you have a fix amount of possible conditions paired with their output.

It would go like this:

#WS_IFS(('Lighting Device'.'Pan'>=-45)&('Lighting Device'.'Pan'<45),'↑',('Lighting Device'.'Pan'>=45)&('Lighting Device'.'Pan'<135),'←',('Lighting Device'.'Pan'>=135)&('Lighting Device'.'Pan'<225),'↓',('Lighting Device'.'Pan'>=225)&('Lighting Device'.'Pan'<=315),'→')#

 

It's always good practice to write the worksheet formula into an actual worksheet first. Once you are happy, you can insert it with this modification #WS_<># into the data tag formula field.

 

I used the first of the available arrow symbols for each direction from here:
https://symbl.cc/en/collections/arrow-symbols/

  • Like 2
Link to comment
33 minutes ago, Antonio Landsberger said:

@markdd

I know an easy way to do this:

Since Vectorworks 2022 you can use worksheet functions within the data tag. In this case I would go with the function IFS, because you have a fix amount of possible conditions paired with their output.

It would go like this:

#WS_IFS(('Lighting Device'.'Pan'>=-45)&('Lighting Device'.'Pan'<45),'↑',('Lighting Device'.'Pan'>=45)&('Lighting Device'.'Pan'<135),'←',('Lighting Device'.'Pan'>=135)&('Lighting Device'.'Pan'<225),'↓',('Lighting Device'.'Pan'>=225)&('Lighting Device'.'Pan'<=315),'→')#

 

It's always good practice to write the worksheet formula into an actual worksheet first. Once you are happy, you can insert it with this modification #WS_<># into the data tag formula field.

 

I used the first of the available arrow symbols for each direction from here:
https://symbl.cc/en/collections/arrow-symbols/

Ha. This is exactly what I eventually came up with! Thanks for taking the time. 

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...