# Data tags and mathematical operations?

## Recommended Posts

Is it possible to do math with data tags?

Example:

A Data tag reads the door rough opening width 1100.

The number 1100 is divided by 100, leaving 11. Letter M is added, thus final text on the tag would be "11M“.

This is just one example, I can think of many others uses as well.

• Vectorworks, Inc Employee

Yes, it is possible. The formula for the example you've given would be "#Door#.#ROWidth# / 100 M". However, you can also change the units in which the result is shown, as I suspect that is what you want. The pop-ups are below the "Parameter Name" pop-up and the formula would be "#Door#.#ROWidth##m_0_1#".

Excellent, thank you! This is very good news indeed.

In this case it's about the local door size denotation standards, the so called "modules" =M =100mm.

I'm not having success. I tried to calculate cost of sheet goods, where is would show #Area# *.5  (for 50 cents a square foot), the data tag shows '150 sq ft * .5' without doing the math

If you just use #Area# do you get the unit marks? If so, then it is probably returning a string instead of a number and math only works on numbers. For many of the PIOs, there are fields that are the numeric version and fields that are the string version including the units. I don't know if there is a numeric version of the Area function.

• Vectorworks, Inc Employee

Write the formula as "#AREA# * 0.5" or "#AREA# / 2".

Adding the zero to 0.5 makes it work, but it still keeps the units as square feet. Using VALUE(#AREA#) returns VALUE(150 sq ft). It works in the report, but not in the tag

• Vectorworks, Inc Employee

Data Tags use a different system for formulas from worksheets. Try using "#AREA#  / 1sq ft * 0.5". You should use the unit in which you'd display the area (the document unit as it is written here or the unit you've selected from the unit popup) and keep the 1 and the unit mark without a space between them.

• 4 weeks later...

Now I have a nice data tag displaying the door size automatically, thank you all!

The only thing missing is: How to read the handedness of the door automatically? Anyone know if this is possible?  With worksheets I've looked into a combination of  IsFlipped and rotation and IF formulas, but so far no solution for all situations.

If we could solve this last bit, then there would be no need for manual size and handedness input any longer, eliminating the possibility of errors.

• Vectorworks, Inc Employee

Since VW26 the Data Tag also has a conditional expression. If that is all you use in the worksheet it should be possible to do it in the Data Tag. What exactly is your worksheet formula?

Currenty I'm using =IF((C2=1); '-L'; '-R')

This refers to IsFlipped column. For simple door, IsFlipped returns 0 if the door is not flipped (right-handed) and 1 if it's flipped (left-handed).

BTW I just realized why "IsFlipped" works on a swing simple but not always on a swing bi-part door.  When drawing a double leaf door,  if the door is flipped in plan and the larger, active leaf is "leaf 2", then the "IsFlipped" value will be misleading. If the active, larger leaf is "leaf1", then it works properly.

Below is an example: The door is not flipped, even though it is "left" handed. Leaf 1 is the smaller leaf, thus creating confusion.

The correct way to draw this would be to flip the door (IsFlipped=1=left) and give the active leaf the larger width.

Am I missing something...or can one use the "IsFlipped" to indicate handedness automatically, if one is careful with double doors...?

• Vectorworks, Inc Employee

Sorry, I thought IsFlipped is a parameter of the door. I don't think you recreate the formula 1 to 1 in the Data Tag. However, the syntax for conditions is "<ExprIfTrue>@"<Condition> : <ExprIfFalse>". Hope this can help somehow. As for the doors: I'm not really familiar with them and can't help there.

Not quite sure how to use <ExprIfTrue>@"<Condition> : <ExprIfFalse>". in a data tag.

I'm trying to make a tag that will look at the area of a rectangle, and if the area is over 100, will say "too large". I tried =IF((#AREA#>100), 'Too Large', 'Too small'), which will work in a worksheet, but not in a tag. What am I missing?

• Vectorworks, Inc Employee

@MSLD the formula you should use for this is:

`"Too Large"@#AREA#>100sq m:"Too small"`

As @TDimov said, the data tag condition expression is: <Value_If_True>@<The_Condition>:<Value_If_False>

Note, you have to be careful with the spaces around the condition, it does not expect any spaces.

It is known problem that the Data Tag uses its own syntax for the formulas. It's at the top of our list to make it use Worksheet formulas in the future.

Brilliant. Thank you. Is there any documentation for that? Or should I not bother making data tags if the syntax is going to change.

• Vectorworks, Inc Employee

@MSLD Well, we always see to convert over when we change things.

So please, don't hesitate to use it at its full capabilities. You can get really nice results.

As for help, click F1 on the Define Tag Field dialog, it leads here:

The collapsed parameters on #8 is talking about the field definition syntax.

It is known problem that the Data Tag uses its own syntax for the formulas. It's at the top of our list to make it use Worksheet formulas in the future

This was going to be my next question. If I interpret this correctly, in the future it will be possible, in principle, to use any worksheet function with data tag?  Including the "IsFlipped" function.

• Vectorworks, Inc Employee
1 minute ago, JMR said:

This was going to be my next question. If I interpret this correctly, in the future it will be possible, in principle, to use any worksheet function with data tag?  Including the "IsFlipped" function.

That's the goal.

• 1 month later...

I'm currently trying to do something like this:

"#ΔX# / 3000"    -this way the division calculation works fine

"3000 / #ΔX#"    -doesn't work, the characters "3000 /" are just printed and not included in the calculation.

How do I divide some number with eg. delta X? Is there a specific syntax that I should use?

BTW vesion 2020 SP6 so far.

Strange. if I write

3000*#ΔX#   - works

3000/#ΔX#    -doesn't work

• Vectorworks, Inc Employee

@JMR In 2021 the calculation logic was completely changed and is more lenient. In 2020 there were strict restrictions on the operands. "#ΔX# / 3000" divides a length by a scalar which is in itself a length. "3000*#ΔX#" is similar in that it multiples instead of dividing. "3000 / #ΔX#" would divide a scalar by a length which would result in a unit of 1/m. It's not a standard VW unit so I chose to prohibit such calculations. Should be doable in 2021 but if you provide more details of what you want to achieve I may offer a workaround for 2020.

Ok thanks. I do have VSS so I guess it's time to update very soon.

I'm designing a facade with fibre-concrete sheets that come in size 1200x3000mm. Ideally, the most economic divisions are therefore eg. 300,400,600 and 300,500, 600,1000 etc.

I'm trying to use the data tag as a tool to quickly check and demonstrate to the client if the desired sheet can be economically cut out from a 1200x300 full-size sheet. This has to do with finding the optimal solution when it comes to looks and waste/cutting.

"#ΔX# / 3000" kind of works but it returns 0.33 for a 1000mm etc, not so easily demonstrated to a client.

• Vectorworks, Inc Employee

I think the following should be of use to you:

Create a new record format and add a dimension field.

Attach the record to the Data Tag or the tagged object.

Change the formula to be "#Record#.#Field# / #ΔX#".

The result would be a scalar (I think what you need - the number of divisions from the sheet).

Thank you.

I got it working for a second, then it disappeared and can't get it to work...enclosed is a sample file, in case you'd want to take a look?

#ΔX#x#ΔY#
circumference #PERIM#
area #AREA##sq m_0_1#
#datataghelper#.#FullLength# / #ΔX#
#datataghelper#.#FullWidth# / #ΔY#

What I see

Helper record is set to "integer"...is this correct?

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

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×
×

• KBASE
• #### MARIONETTE

×
• Create New...