Bruce Kieffer Posted December 15, 2023 Share Posted December 15, 2023 Is it possible to use an if/then formula in a data tag definition? I'm tagging a Material I named PB, and I want to tag that as Particle Board. Alternatively I could change the Material to Particle Board and use an if/then formula in my worksheets that count the Particle Board Material, and make them display PB. Quote Link to comment
Tom W. Posted December 15, 2023 Share Posted December 15, 2023 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. Quote Link to comment
Pat Stanford Posted December 15, 2023 Share Posted December 15, 2023 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. Quote Link to comment
Bruce Kieffer Posted December 15, 2023 Author Share Posted December 15, 2023 You both understand what I want. @Pat StanfordI'm pretty sure I can make the #WS_IF(condition, true value, false value)# formula work. I also like Tom's suggestion if I can make that work. @Tom W. Can you explain how I make the Material Description field appear as the tag data? Quote Link to comment
Tom W. Posted December 15, 2023 Share Posted December 15, 2023 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: The Data Tag settings: The Data Tag in action: 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) : 1 Quote Link to comment
Bruce Kieffer Posted December 15, 2023 Author Share Posted December 15, 2023 @Tom W. That's cool. I have it working. 2 Quote Link to comment
Itchy Posted November 19, 2025 Share Posted November 19, 2025 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. Quote Link to comment
Tom W. Posted November 19, 2025 Share Posted November 19, 2025 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. 1 1 Quote Link to comment
Itchy Posted November 19, 2025 Share Posted November 19, 2025 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. Quote Link to comment
Tom W. Posted November 20, 2025 Share Posted November 20, 2025 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. 1 Quote Link to comment
shorter Posted November 24, 2025 Share Posted November 24, 2025 Would an IFS formula work too? IFS('WinDoor 6.0'.'Type'='Sliding Left Door', CONCAT('2/', 'WinDoor 6.0'.'CSLeafWidth'),'WinDoor 6.0'.'Type'='Sliding Right Door',CONCAT('2/', 'WinDoor 6.0'.'CSLeafWidth'),'WinDoor 6.0'.'CSLeafWidth') ? Quote Link to comment
Pat Stanford Posted November 24, 2025 Share Posted November 24, 2025 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. 1 Quote Link to comment
shorter Posted November 26, 2025 Share Posted November 26, 2025 (edited) ...or conversely the IFS sets you up to be able to change individual values... I am forever thinking 'WhatIFS?'... Edited November 26, 2025 by shorter Quote Link to comment
Pat Stanford Posted November 26, 2025 Share Posted November 26, 2025 Different horses for different courses. 😉 I am older than IFS, so I almost always revert to nested (or serial) IF statements. Because I never remember that IFS exists. 🤷♂️ Quote Link to comment
ashot Posted November 26, 2025 Share Posted November 26, 2025 check this VW plugin for Catenary Ropes and Cables https://fitplot.it/vwplugins/catenary.html Quote Link to comment
Recommended Posts
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.