Shape data lost if sort key is changed

Started by joshuag, February 27, 2022, 08:21:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

joshuag

Version: Visio Pro 2021

I will often want to alter shape data sets that apply to a host of shapes. Adding a new property to the shape data set totally works fine, but the order is often annoying so I want to change the shape data set element's "sort key." FYI this must be done in developer mode to have access to the sort key. This is a pretty straight forward thing and I am blown away that this doesn't work correctly. Short story is that if a shape data set is used and then applied to a shape or shapes, and then you decide to change the sort key of the elements of that shape data set, the shape data is lost. No only that, but its as though some pointer gets totally borked because the shape data graphics no longer work properly: The shape data shown in the shape data window will all reset to the default value, but the data graphics don't lose their shape data. However, the shape data graphics will no longer update with changes to the shape data once alteration to the shape data set sort keys has occurred. And if you look at the ShapeSheet, you will see all the values are default, but still somehow the shape data graphics are maintaining whatever data was entered.

Reproduction of this is really easy:
1. Make some shapes on a blank sheet.
2. Using the "shape data sets" pane, create a shape data set with a couple of elements using "Add", or "Define" if there  is an existing shape data set: I think there is a sample shape data set that suffices, with two elements "Description" and "ID" but anything will work so long as there is more than one element. Leave the values blank. Click okay when done to exit the shape data set definition window.
3. Select all shapes on the sheet and using the shape data sets pane, select the shape data set check box for your shape data set and click "apply" to apply the shape data set to all the shapes.
4. Make a unique entry for the first property of the shape data for each shape using the shape data window.
5. Select all shapes and then use "Edit Data Graphic" to show this by creating a New Item that displays the unique property as text. Click okay and say yes to apply to the shapes when prompted. You should now have a bunch of shapes with their first property, all with some unique text, displayed as a data graphic. So far all works as normal.
6. Edit the shape data set again by selecting the shape data set and clicking "Define..." and alter the sort key for each element. Again, this is done to the master shape data set object, not to an individual shape's shape data. The goal here is to sort all the shapes shape data by altering the master shape data set object. Click okay.

What you should see now is that the shape data graphic still retains whatever unique identifier you gave. So at first glance everything seems okay. However, if you click on the shape to see its shape data, the data is gone. Try altering the the data in the shape data window and changes to it will NOT reflect in the shape data graphics. Somehow changing the sort key of the shape data set has caused a disconnect between the shape data and the shape data graphic. The shape data graphic somehow retains all the data but is no longer linked to the shape data as shown in the shape data pane.

Any thoughts? Help?

One lame work around I found is that you can change the sort key's of each individual shape's shape data without issue, but that's an annoying work around. You should be able to alter the master sort keys via the shape data set just like you can alter the master to add more elements and see these new elements applied to al the shapes.

Paul Herber

Can you post an example in an attachment?
Electronic and Electrical engineering, business and software stencils for Visio -

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

joshuag

#2
Yes here is a simple file with one shape, a shape data set, that shape data set applied to the one shape, and data graphics for both elements of the shape data. The shape data currently works normally when you open the file. If you go to the shape data sets, select "Sample" and click "Define..." you can see the shape data set. Go in there and change the sort keys to anything but blank: if you just change one of them and click OK you will see that element's shape data in the shape data window get lost but the shape data graphic will still retain the data previously entered. Change both element sort keys and they both get clobbered.

FYI: You have to be in developer mode to adjust sort keys.

wapperdude

Shape Data window worked fine for me.  Followed the steps that you provided.

Using V2019Pro.
Visio 2019 Pro

joshuag

Did you alter the sort keys in the "Shape Data Sets"? Altering the sort keys in the Shape Data works, but not in the Shape Data Sets where the master object is defined. At least not for me.

wapperdude

When I open your file, get single page plus Shape Data Sets Window.  Changing the Sort Key only impacts Shape Data Window. See https://docs.microsoft.com/en-us/office/client-developer/visio/sortkey-cell-shape-data-section.

So, I open the Shape Data Window.  For the Shape Data Set to function, at least one appropriate shape must be selected.  This also populates the Shape Data Window.

Select shape, select the data set in the Data Set window, choose Define..., select sort key and enter 2 for Description  and 1 for ID, OK.  The order of these changes in the Shape Data Window.  Nothing disappears. Even if only 1 sort key is altered, leaving the 2nd one blank. 

If I duplicate the shape a couple of times.  Then select all.  Still works fine.  Shape Data Window shows multiple selections, but behaves.  Looking at each shape's shapesheet shows the sort keys as expected.
Visio 2019 Pro

wapperdude

#6
Note, I took this a step further, and created a master on the Document stencil.  Selected it, and only it, made changes in the Data Set Window, hit OK,  hit apply.  As the master was updated, all of the shapes on the drawing page updated as well.  The Shape Data Window shows the appropriate sort order for each, subsequently selected shape.  Everything reacted as anticipated.
Visio 2019 Pro