Return Sheet Reference via Connection Point?

Started by celoranta, March 10, 2017, 09:01:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

celoranta

I would like to create a shape that reads a standard set of values from any instance of another (specific, stencil-based) shape based on a connection between two shapes.

To decode my request a bit:

Shape A is a text block with a user-draggable control point connected by a line, and user data field "X"
Shape B is an instance of a master stencil.  It includes a connection point and a user data field called "Name" with the text "Chris" in it
Shape C is a second instance of a master stencil.  It includes a connection point and the same data field with the text "Katie" in it.

When a user drags the control point on shape A to the connection point on shape B, Shape A user data field "X" value = "Chris."
When a user drags the control point on shape A to the connection point on shape B, Shape A user data field "X" value = "Katie."

A quick review of the function list did not get me anywhere. 

It frustrates me that I'm able to SEE the "target" sheet name in the control point formula within my "Shape A..." but I can't figure out how to pull that information from the control row to create a reference.

I'd be more than satisfied if I just had a function to return the formula of a cell as a string.  I could parse it from there with FIND,LEFT,RIGHT,& etc. and then use SETF to send the parsed string as a formula to another cell.

I also found the "callout shape" function in my searches.  This returns the information, just like I want (in concept,) but it is INSERTED right into a shape.  A user cannot drag the connection line to a new shape.

THoughts?



wapperdude

First, a bit confusing as you're mixing your terms.  So, to be sure we're on the same page...

A stencil is a collection of shapes.  The shapes on a stencil are generally c considered master shapes.  The stencil shapes are dragged and dropped onto drawing page.   

As I understand what you're saying, on the drawing page, you have 3 shapes:
    1:  Shape A:  title block, with a control point
    2:  Shape B:  a "name" shape with Chris as text
    3:  Shape C:  a "name" shape with Katie as text

Move the control point to a connection point on Shape B, and Shape A inherits the text, "Chris"
Move the control point to Shape C connection point, and now Shape A inherits the text "Katie"

This can be done with code.  Which version of Visio?

Wapperdude
Visio 2019 Pro

celoranta

I'm using Visio Standard 2013.

Thank you for correctly interpreting my post.  I should restrict myself from posting in the wee hours.  A re-read this morning caught lots of embarrassing errors.

Thank you also for the corrections on my terminology.  I'm not sure I grasp completely the precise definitions of "stencil," "shape," and "master shape."  Can you refer to me to specific page that gives me a quick rundown?  (I grasp these concepts in general terms, but a precise understanding would improve my communications.)

For the record, the example I gave was a simplification; but only insofar as the number and type of data points inherited.  I would actually inherit a dozen (or so) values from the properties, dimensions, and user data fields. 

While we are at it, is it also possible for the "target" shapes to be aware of whether such a connection has been made?

I have not, as of yet, dabbled in the world of Visio-VBA.  Is that what you meant by "code?"  I have a rustic understanding of VBA within Excel.  Honestly, I was hoping to keep out of that sphere, but I am willing to dabble if that is the only solution.

Thanks again,

Chris

AnotherNoOne

Just wanted to comment, so i get the answer too, have the same problem atm.
Another_Noone

Just some weirdo on the Interwebs.

Paul Herber

To get an email whenever a reply is posted to a certain message thread then all you have to do is click the Notify button.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

Croc

It seems to me that this behavior is achieved with the CALLOUTTARGETREF () function.
Is not it?

wapperdude

@celoranta:
QuoteCan you refer to me to specific page that gives me a quick rundown?

Objects on the drawing page are just considered shapes.  Typically, something like sheet.1.  Some shapes are just, well, shapes.  They might be rectangles that you draw, or circles.  They are unique, since they are not based upon a prior shape.  Some shapes, however, are based upon master shapes.   When a master is dragged and dropped from a stencil, two copies of it are created.  One on the drawing page and one on the document stencil.  The document stencil contains a replicated master, a twin.  The drawing shape, actually points to this twin and not the literal stencil master.  That way, a Visio drawing only contains shapes it is using or has used, and need not contain all of the 100's of stencil master shapes.

Wapperdude
Visio 2019 Pro

Gustavo

Hi! maybe the content in this post by Surrogate will help you.. I think is half the way of what you're looking for.

http://visguy.com/vgforum/index.php?topic=6171.0

I've been looking to do the same, but with the value of the Prop.n cell in the example, which reference the shape ID of a second shape, or the value of the NAME() of any second shape, "catched" automatically by means of a connection point, or passed trough a connector, as the BeginX, BeginY,End X & EndY cells of the 1-D Endpoints section does when a connector shape connect.  But I have still no success to pass the value generated by the NAME () function automatically from one shape to another.  :-[

wapperdude

@Gustavo:

Assume that sheet.1 is the shape of interest, and sheet.2 is the shape wanting to know.  In sheet.1, create a User entry, call it User.Name. and enter the formula =name().

In sheet.2, create another User entry, call it, oh perhaps, User.gotcha, or whatever.  Enter the formula =GetVal(Sheet.1!User.Name).  That should return Sheet.1.

Wapperdude
Visio 2019 Pro

Gustavo

Hi @Wapperdude, thank your for your help & assistance.  :). With the help and examples of the forum, I know now how to get values from shape(a) cell to another shape(b) cell with getval function or with sheet! references. What I'm trying to do is to find a way to that automatically by a connector shape.

Why? This is for a solution that I'm building with 5000+ shape instances in a network, linked in groups by a connector shapes, and I want to pass a value calculated with data in each shape, through their connections, until the end of the group. If I can do it automatically, it would save me hours and hours of capturing data, and it would make reconfiguration a lot easier for users. It would be better if I use only shape sheet functions.

That's why I've been thinking to take the formula generated in an BeginX, EndX cell or EndY cell of the connector shape, and programatically discard the functions I won't use to get the connected shapes NAME() value, to automatically use them whenever I connect them with a connector shape . But I still have no luck. Any ideas are welcome.

wapperdude

Ah.  I misunderstood your comment re Name().

When a connector is glued to a shape, the BeginX, for example, refers to the BegTrigger cell in the Glue Section.  This displays a formula that refers to the shape glued to the Begin of the connector.  I don't think the shapesheet has enough functionality to parse the formula and extract the shape name.  My opinion would be to use VBA and write a parsing macro.  Good news, I believe the newer Visio releases have updated the object model to include simple function to get the connected shapes, so, no need to do any parsing, it's already done.  At least, that's my understanding, as I only have V2007.

Wapperdude
Visio 2019 Pro