Jump to content

Data Tag If/Then formula?


Recommended Posts

If I understand you correctly a more straightforward option might be to just enter 'Particle Board' in (for example) the 'Description' field for the Material: then, depending on the formula you used, you could return either 'PB' or 'Particle Board' in your tags/worksheets depending on what you wanted to see at any one time.

Link to comment

The best way to do IF/Then in a Data Tag is by using the Worksheet IF command. I think you are already familiar with this from using it in worksheets.

 

In a DataTag formula you enter it as:

 

#WS_IF(condition, true value, false value)#

 

Inside the function (between the #WS_ and the end #) you have to use pure worksheet functions.  You can't use Data Tag nomenclature inside the #WS_ # block.

 

Ask again if you need more help.  Or even better, post a file with your data tag format and a couple of your PB objects so we can make sure we are offering the correct solution.

Link to comment
49 minutes ago, Bruce Kieffer said:

Can you explain how I make the Material Description field appear as the tag data?

 

For example:

 

The Material settings:

Screenshot2023-12-15at19_35_05.thumb.png.a9b057385872d84c743e7db135b5cbb3.png

 

The Data Tag settings:

Screenshot2023-12-15at19_34_07.thumb.png.35d26d024f1fffbbb71e62b1f1fd5434.png

 

The Data Tag in action:

Screenshot2023-12-15at19_34_26.thumb.png.3a4cce448b8c9064dbba97612cd7a231.png

 

There is tons of useful data you can attach to Materials. Here is the full list of values you can return using the formula above (from Worksheet Functions) :

Screenshot2023-12-15at19_37_59.thumb.png.a76d40aa9e695b2d38581b1b472e6f97.png

 

  • Like 1
Link to comment
  • 1 year later...

Hijacking an old thread, but can I do this with Windoor Objects?

 

#WS_IF((WinDoor 6.0'.'Type') = 'Sliding Left Door', true value, false value)#

 

I have tried to modify what was posted about, but haven't got it to work. What I want to do is if the type of door is either sliding left or sliding right, I want it to add a '2/' before the leaf size. For some reason the built in Windoor ID does it, but i can't get the data tag to replicate it. If the type is not sliding, then it shouldn't put anything in front.

 

Thanks.

Link to comment
23 minutes ago, Itchy said:

Hijacking an old thread, but can I do this with Windoor Objects?

 

#WS_IF((WinDoor 6.0'.'Type') = 'Sliding Left Door', true value, false value)#

 

I have tried to modify what was posted about, but haven't got it to work. What I want to do is if the type of door is either sliding left or sliding right, I want it to add a '2/' before the leaf size. For some reason the built in Windoor ID does it, but i can't get the data tag to replicate it. If the type is not sliding, then it shouldn't put anything in front.

 

Thanks.

 

I think this will do what you want:

 

=IF((('WinDoor 6.0'.'Type'='Sliding Left Door') | ('WinDoor 6.0'.'Type'='Sliding Right Door')), CONCAT('2/', 'WinDoor 6.0'.'CSLeafWidth'), 'WinDoor 6.0'.'CSLeafWidth')

 

Put this in the 'Formula' pane. If the WinDoor object is a Sliding Left Door or a Sliding Right Door the leaf width will be returned with '2/' in front of the value, otherwise it will just return the leaf width normally.

 

 

  • Like 1
  • Love 1
Link to comment

Awesome, thanks @Tom W..

I was putting it into the advanced field rather than formula. What you have works perfectly. I need to tweak it now for other options, but it will allow me to use data tags now for all my internal doors rather than using the built in windoor ID, which isn't as flexible as the data tag.

Link to comment
7 hours ago, Itchy said:

I was putting it into the advanced field rather than formula.

 

You can equally do it in the Advanced Calculated Field, you just need to wrap it in #WS_# like you were doing in your example i.e.:

 

#WS_IF((('WinDoor 6.0'.'Type'='Sliding Left Door') | ('WinDoor 6.0'.'Type'='Sliding Right Door')), CONCAT('2/', 'WinDoor 6.0'.'CSLeafWidth'), 'WinDoor 6.0'.'CSLeafWidth')#

 

In your example you were missing the single quote before WinDoor 6.0.

  • Like 1
Link to comment

As far as I know it should work. I am not aware of any WS formulas that don't work in Data Tags.

 

But in a case like above, I would stick to the standard IF and use the vertical bar (OR) symbol.

 

If you use IFS then if you need to make a change your have to change the value in multiple places. If you use the OR method, then you only have to change the output in a single place.

 

And there is a limit of approximately 1000 characters in a worksheet formula. If you have [CONCAT('2/', 'WinDoor 6.0'.'CSLeafWidth'] (40 characters) in your formula multiple times you are going to push up against that limit much more rapidly than if you only have it once.

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