Jump to content

Data tags in Graphic legends - if statements and other notes


Recommended Posts

I've been trying to add the word "note:" to a field in a slab "data tag" (in a graphic legend) before the field content and have been unsuccessful What I want to do is check if field is blank, and if it is not, add the word "note: " before the field in the data tag. I've been using <Value if True>@<The Condition>:<Value if False> format (I wish a normal If statement worked in data tags). Here is my code:

 

Note:#IfcSlab#.#Pset_ManufacturerTypeInformation#.#Manufacturer#@(#IfcSlab#.#Pset_ManufacturerTypeInformation#.#Manufacturer#<>''):''

 

I cannot get the "Note:" part to append to the field information only if it is not blank. I've tried using concat and a number of other methods but nothing seems to work. Is this possible? I wish data tags had proper quoted strings and operands instead floating text where it is unclear what it is doing or how it interacts with field data.

 

I would also like to see some user defined fields in data tags in graphic legend to allow for a user defined field, like in regular data tags. I know a user can add an annotation but it isn't the same work flow.

Link to comment
  • Vectorworks, Inc Employee

Hello @David Poiron,

 

I managed to get this working by adding a separate if statement for the Note placement, like this:

 

'Note:'@(#IfcSlab#.#Pset_ManufacturerTypeInformation#.#Manufacturer#<>''):''#IfcSlab#.#Pset_ManufacturerTypeInformation#.#Manufacturer#@(#IfcSlab#.#Pset_ManufacturerTypeInformation#.#Manufacturer#<>''):''

 

Best Regards,

Nikolay Zhelyazkov

  • Like 2
Link to comment

I think Nikolay provides these great answers just to give me the ability to pontificate. 😉

 

David, you seem to already know about the Ternary If statement in data tags.  'Use This' @ (if the statement here is true) : 'Else Use This'

 

So the stuff before the @ displays if the statement between the @ and the : is true, otherwise the stuff after the : displays.

 

In this case the stuff after the colon is an empty string (two single quotes next to each other '') so there is nothing there at all.

 

So the overall statement has two if statements, one around the Note text and one around the field value.

 

In VW2023 (and maybe 2022??) you can also now do this with the #WS_IF function but for this case displaying IFC data you would also need to use the WS_IFC functions and I think it would be even more convoluted and harder to read.

 

Hope this helps someone else figure out what this is actually doing.

  • Like 4
Link to comment
  • 2 months later...

Sure. I recommend the Worksheet IF as it is easier to read.  Something like:

 

#WS_IF(AND('Your'.'Field'>0, 'Your'.'Field'<=10),'Number in Range', 'Out of Range')#

 

Tell me where you range of numbers are coming from and I can try to give you an exact answer.

 

Not that this is assuming the the values are actually numbers and not text.  You might need to wrap the record.field in a Value() command to get them as numbers.

  • Like 2
Link to comment

Hi Pat

 

What I am attempting to do is display a note on a Lighting Device when it has a Pan value of between 45 and -45°. Based on your answer above, this is what I have entered into the Tag Field definition:

 

#WS_IF(AND('Lighting Device'.'Pan'>-45, 'Lighting Device'.'Pan'<=45),'Number in Range', 'Out of Range')#

 

Currently I get no error in the tag which is a plus, but also no text either!

 

Thanks

 

 

Link to comment

The next to last line in this screen shot should be what you need. I have also included it in the code block below so you should be able to copy/paste it into your Data Tag.  I put the entire screen shot in to give you some idea of how I tested/debugged this. I had a hard time getting the quotes and parentheses and periods/commas right on this to make it work. I think I need new glasses or a screen with lower resolution so the text is bigger. 😉

 

I also lied to you.  🤦‍♂️😞 There are no worksheet functions called AND or OR.  You specify an Logic AND with an ampersand character &.  You specify a logic OR with a vertical bar character |.   

 

HTH.

 

image.png.9980d080fe74b805c1127c66bb9614f8.png

 

#WS_IF((VALUE('Lighting Device'.'Pan')>=-45) & (VALUE('Lighting Device'.'Pan')<=45), 'In Range', 'Out of Range')#

 

  • Like 1
Link to comment

Pat, this is great! Thanks. Works perfectly.

 

Can you recommmend a resource other than your good self which would help a non-maths, non-coder person like myself to learn this kind of stuff with particular regard to Vectorworks. For instance, what is the Worksheet/Data Tag language based on?

 

Many thanks again.

 

Mark

Link to comment

The worksheet functions used to be in the Vectorworks Help, but the number of functions was greatly expanded in VW2023 and now there is just a link to the function documentation on the developer site in the help.  Seach "Worksheet Functions" in the help for the link. Or use the one below:

 

https://developer.vectorworks.net/index.php?title=Worksheet_Functions

 

I have not found (or at least can't re-find, I thought I had one once) a reference to the available Dynamic Text (# #) syntax used in Data Tags and Graphic Legends.  I guess they think that the pull down menus in the Dynamic Text builder are sufficient.

 

And as I have shown, Dynamic Text can now use the Worksheet functions by using the #WS_  # wrapper. 

 

You can not mix and match between the two styles indiscriminately.  Everything INSIDE the @WS_ # block must be strictly Worksheet format. It is sometimes easier to actually work this out in a worksheet and copy/past into the Dynamic Text wrapper after it is working. Saves the Edit Tag Layout and Edit Dynamic Text button clicks as you are working through iterations.

 

You can mix and match between the Dynamic Text and Worksheet functions in a single tag as the returned text will just be the pieces that each # # block returns contatentated together.

 

Asking if you get stuck is probably the better part of valor, but I do like to see people wanting to learn about this stuff.

 

HTH

 

 

  • Like 2
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...