### Author Topic: Calculating with Visio - 2  (Read 16817 times)

0 Members and 1 Guest are viewing this topic.

#### Yacine

• Hero Member
• Posts: 2953
##### Calculating with Visio - 2
« on: May 02, 2010, 02:14:49 AM »
This post was first thought to be only an answer to a question, but I think that it can be used for other purposes as well and gave it it's own post.

The shape provides a field in which you can write freely formulas referencing other shapes, without the need of opening the shapesheet.

the syntax is relatively simple to understand:
1) [shapeName] references ShapeName!prop.value
2) if you want to access a different prop, you need to write it in the shapesheet syntax ie: ShapeName!prop.RowName

It comes with 3 sub-shapes containing the name, the value and the formula.

The formula can be hidden by dragging its control under the value sub-shape.

As the controls can glue to the controls of other shapes, you can easily make calculation blocks, that show or hide the formulas.
« Last Edit: December 24, 2015, 03:33:31 PM by Yacine »
Yacine

#### calkevicius

• Newbie
• Posts: 3
##### Re: Calculating with Visio - 2
« Reply #1 on: August 14, 2020, 05:24:16 PM »
Lets say I had 5 shapes on a page and they all had a shape data category called "Weight" could I use these blocks to sum the weight of all the shapes?

#### vojo

• Hero Member
• Posts: 1670
##### Re: Calculating with Visio - 2
« Reply #2 on: August 14, 2020, 07:00:12 PM »
Yacine, I don't think that works since the shape would have convert the text
"sheet.1!prop.weight" to sheet.1!prop.weight    // no quotes and double or triple quotes did not work circa visio 2003.
maybe visio 2019 or teams visio solves this issue.

Unless there is some new functions, years ago I tried this trick and could not get it to work since the text to formula conversion could not be accomplished.  Also, if the page is the "accumulator", then adding shapes would need to add rows and deleting shapes would mean at least a way to 0 out a row.  as I recall, even
setf(sheet.1!prop.sum, sheet.1!prop.sum+sheet.2!prop.weight) is risky since bypass visio cell database ==>pick wrong shape cell because reference picks a different shape.

if user formula function then the shape id piece would have to be identified via some discovery and place in the shape such that its a reference to other shape not a text as input into user formula.

If you, indeed, found a way, please share the details.

#### vojo

• Hero Member
• Posts: 1670
##### Re: Calculating with Visio - 2
« Reply #3 on: August 14, 2020, 07:07:41 PM »
but if you could do this, it would indeed up a whole new frontier for visio.
- shape awareness (discovery, even with some manual help, of other shapes)
- hidden comm links between shapes (a hidden pipe to share all kinds of shape data or shape row values)
- assign shapes a page specific or app specific handle (e.g. sort of like DHCP for visio).
- various checks like are the right shapes on the page to do op XXX
- visiable shape replacement (could do relative position of shape A to shape B...user view of setting a group).
- visiable format of shape (if my value is X, then shape Y is half size or green because I update width and height and fill color).
-etc.

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 4374
• Ideas Visio-lized into solutions
##### Re: Calculating with Visio - 2
« Reply #4 on: August 15, 2020, 11:08:13 AM »
Slightly different approach.  Using SETATREF.  See attached.
Example uses a "target" shape, Sheet.1.  Could be the ThePage.  Target shape has User Defined entry, User.Wt, as accumulator.

The "weighted" shapes have shape data entry, Prop.Wt.  The value cell has SETATREF function.  The function calls target shapes current value and adds new value.  The user must enter a new value, otherwise, the SETATREF function will add the existing target value to itself, effectively doubling the value.

This approach has a major suffering...it doesnot eliminate a deleted shape from the total value in target shape.
Visio 2019 Pro

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 4374
• Ideas Visio-lized into solutions
##### Re: Calculating with Visio - 2
« Reply #5 on: August 15, 2020, 11:25:03 AM »
Fixed the data entry.  No longer doubles the value.

Work-around for eliminating a shape...enter it's negative value 1st to subtract from total.  Then, delete the shape.
Note, dbl click shape brings up its shapedata form.
Note 2:  if you need to change a shapes value, you need to 1st subtract existing value, then enter new value.
Visio 2019 Pro

#### vojo

• Hero Member
• Posts: 1670
##### Re: Calculating with Visio - 2
« Reply #6 on: August 15, 2020, 06:42:09 PM »
oh...so this ignores the whole text to function translation.

Thus still static set of shapes and relationships.

More a convenient user friendly way to pick which canned function.

Misunderstood, apologizes....I thought you found a variable way to find/pick a shape to and do something with it

#### wapperdude

• Global Moderator
• Hero Member
• Posts: 4374
• Ideas Visio-lized into solutions
##### Re: Calculating with Visio - 2
« Reply #7 on: August 15, 2020, 07:02:30 PM »
@Vojo:  Yep. This struck me as reasonable work-around for this specific scenario and avoid VBA.  The more appropriate solution is VBA.
Visio 2019 Pro

#### Yacine

• Hero Member
• Posts: 2953
##### Re: Calculating with Visio - 2
« Reply #8 on: August 17, 2020, 02:27:02 AM »
Lets say I had 5 shapes on a page and they all had a shape data category called "Weight" could I use these blocks to sum the weight of all the shapes?