Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: chelmite on December 30, 2018, 07:07:07 PM

Title: Visio ShapeSheet ShapeData: keep two rows in sync
Post by: chelmite on December 30, 2018, 07:07:07 PM
I have two Shape Data rows for a Shape's ShapeSheet:

Shape Data  Label   Prompt   Type Format                                                     Value                       Invisible
Prop.Type   "Type"   ""         4 "Alpha;Beta;Gamma;Delta;Epsilon;Zeta;Eta;Theta;Iota;Kappa" INDEX(4,Prop.Type.Format)   False
Prop.Abbrev "Abbrev" No Formula 4 "A;B;G;D;E;Z;E;T;I;K"                                      INDEX(4,Prop.Abbrev.Format) True


The way I intent to use this is to have the user select the Type, say Epsilon, and then have the Abbrev automatically switch to the corresponding value in the Prop.Abbrev.Format.

Note: the values used here are placeholders for the actual values for my application, which are not shown here so they don't distract from the real answer I need, how to keep the selections in sync when the first one is selected or changed.

The "INDEX(,Prop.Type.Format)" is created automatically when a value is selected in the Shape Data dialog. How can I get access to the index value? ("4" in this case) What functions operate on the string array that is the Format field?

Thanks for any help you can give!
Title: Re: Visio ShapeSheet ShapeData: keep two rows in sync
Post by: Yacine on December 30, 2018, 09:07:54 PM
Hi Chelmite,
You don't want to synchronize the two lists.
What you want is the nth element of the second list.
n being the position of the element selected in the first list.
This position is: lookup(prop.type, prop.type.format)
Now you replace the number 4 from your post by this formula and you get:
  Prop.Abbrev = index(lookup(prop.type, prop.type.format), prop.abrrev.format)
https://docs.microsoft.com/en-us/office/client-developer/visio/lookup-function (https://docs.microsoft.com/en-us/office/client-developer/visio/lookup-function)

Actually Prop.Abbrev doesn't even need to be a list. It can be a simple text (string) field - eg user.Abbrev for the calculated value and user.AbbrevList for the values list.
Title: Re: Visio ShapeSheet ShapeData: keep two rows in sync
Post by: Surrogate on December 31, 2018, 03:46:59 AM
cross-post with answer (https://stackoverflow.com/questions/53975949/visio-shapesheet-shapedata-keep-two-rows-in-sync)
Title: Re: Visio ShapeSheet ShapeData: keep two rows in sync
Post by: chelmite on December 31, 2018, 07:28:08 AM
Ah, LOOKUP works on the stringified list! I thought it worked on a real list, which is why I rejected it.
Thank you!