Modifying an applied dataset affects ALL applied data sets strangely

Started by rainfordr, March 21, 2017, 11:01:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rainfordr

Hi,

I have a lot of datasets which I have applied to several custom stencils. The datasets need modifying occasionally but I've noticed when I alter a dataset (by adding a new property or by changing an existing property) which has been applied to one or more master shapes in a stencil ALL shapes which the altered dataset has been applied to have every dataset other than the modified one deleted when an instance is dragged onto the page. I'm not reapplying the dataset to any masters, just clicking 'define' and altering the dataset itself.

This is nothing to do with the Document Stencil. I've cleared that out.

To recreate the problem say you have two masters in a stencil MasterA and MasterB, both with no data.
two datasets are created with two properties each Set1 = {set_1_p1, set1_1_p2} and Set2 = {set_2_p1, set_2_p2}.
I apply these to both MasterA and MasterB.

All good so far. When instances are dragged onto the page they contain the correct sets and all properties. the masters also contain the correct sets and properties in both the shape data window and the shapesheet.

I now delete all Document Stencil masters so future instances are not taken from there and delete the current instances from the page.

I then define Set1 and add a new property, set_1_p3, and click OK to close the define window. So Set1 = {set_1_p1, set1_1_p2, set_1_p3}. I have not applied the dataset to any Masters.

If I check the Shape data window and the shapesheet of both masters they do not show the changes to the data set. They both still just have p1 and p2 of Set1 and Set2. no p3 to be seen.

BUT - when I drag a shape onto the page from either master the instances now only show properties from the modified set1, {set_1_p1, set1_1_p2, set_1_p3}. Set 2 is nowhere to be seen in the shape data window.

BUT (again) - in the instance's shape sheet the User.CPMSetList cell's value shows both Set1 and Set2 and the prompt shows both Sets' unaltered, original properties. No set_1_p3.

Sorry for the verbosity here, I just wanted to be clear what I was seeing and how it could be reproduced.

Can someone explain what's going on here and whether there is a workaround? I don't understand:

1. Why the change is not shown in the master but occurs once an instance is dropped on the page. and
2. Why the Instance has the original set lists' properties listed in the CPMSetList cell, but the shape data cells have only the new, altered set's properties.

Any assistance would be greatly appreciated. I can't go through reapplying the data sets every time I alter one slightly as some shapes don't use all of the properties.

Many Thanks,

Rob

EDIT:

As another interesting point if, after I have edited Set1, before I drag an instance onto the page I first turn Design Mode on, then the unchanged original properties from the master are displayed in the instance. this makes me think that there is some kind of code or script running in the background when an instance is dropped onto the page. But there is nothing visible in the shape sheet...

It should also be noted that the document stencil masters only ever have the regular stencil master's properties at any point. Never the new properties.

blairmc98

I'm having a very similar issue, maybe the same one described above.

I've created data sets and applied them to multiple objects.

One of the fields is a fixed list (also tried with variable and have the same issue).

I then select an item, choose an item from the fixed list and move on to another one.  This works fine and each item has its own entry for that drop down.

I then open data sets again and modify the data set, adding or subtracting entries in the format field of a fixed or variable list.  As soon as I click ok (not clicking apply) after clicking define in shape data sets, all shapes with that set get their selections reset to nothing, or sometimes the first option in the list, if it's a variable list.

My data needs aren't complex, I have an office space drawing and I'm modifying the "space" stencil in Walls, Doors and Windows according to physical walls with the pencil and it calculates the square footage, that works great.  I then want to just specify the type of area in the office, so we can know how much square footage there is for offices vs break room, etc.  I'm also making it change the color based on the area using data graphics, and that works great, provided I don't ever modify my list of area types!

I have a list of 6-7 area types, and I won't be adding to this list often, but we could in the future, and I should be able to, without all the existing stencils having to be re-assigned.

I really hope I'm just missing something here and we haven't found a bug, but based on the post above, it may be a bug.

If anyone can offer assistance, it would be greatly appreciated!

Yacine

2 ideas:
1) Never bind a field to a fixed list, if the external data may have values that are not in the list. Use variable lists instead.
2) If you use IDs to identify your shapes, it is not a problem to lose their binding to a data set. An automatic linking can restore all the data.
Yacine

blairmc98

I guess I'm not understanding how to do this.

I'm not using the field to identify the specific area, but rather groups of items, so all offices, conference rooms, restrooms, etc each have their own item in the format field.

Below are the steps to recreate my problem, any advice you can give on how to do this properly would be greatly appreciated!

  • Create blank drawing
  • Drop any stencil onto the screen
  • Right click stencil and click Data, shape data
  • Right click the shape data window and click Shape Data Sets
  • In the shape data sets window, click add.
  • Type a name for the new set, select Create a new set and click ok.
  • Select the new set and click Define.
  • Create a field of type Fixed or Variable list
  • Type several items in the format field like this: test1;test2 and click ok.
  • With the stencil selected, click the checkbox next to the new list and click apply.  You should now have a drop down in the Shape data window with selections typed in step 9.
  • Select one of the options to set it on that stencil.
  • Go back to the Shape data sets window, select your new data set, and click define.
  • Add one more option to the format field: test1;test2;test3
  • Click ok.
  • Select the stencil and you will find that the selection you made previously is now gone.  It will do this for all items with that data set.

FYI, I've tried this on both the 32 and 64 bit versions of Visio Professional 2013, as well as a trial of Visio 2016, 32 bit, and they all exhibit the same behavior.  I must be doing something wrong with regard to how to use this feature.

Thanks!

Yacine

Alright, now I got you. I confused external data with datasets.
and I could indeed replicate your problem. It seems like Visio is re-creating the dataset, so all already defined data get lost.

Your issue is, that you want to modify later the list of values offered in either the fixed or the variable list.
My advice would be to reference the format value of the list from a prop value of either the page or the document.
prop.myList.Format = thepage!prop.myListValues (eg = "test1;test2;test3")
This workaround would give you a maximum of flexibility.

Check the attachment.
Yacine

blairmc98

Thank you!

I'm not 100% sure on how to accomplish that, but it seems like the proper way to do it, reference a list that doesn't get rebuilt.

I'm assuming I do this in the ShapeSheet, right?  I've viewed it but never added my own properties.  Can you point me to some info on how best to accomplish this?  I added a field under user-defined fields in the ShapeSheet, but am unsure how to make the shape data format box reference what I added.

If storing the data in an external file, such as an excel makes more sense, I can certainly do that, but my list will probably only ever be less than 10 items long, and not change very often.

Thanks!

Yacine

Yacine

blairmc98

I'm obviously missing a step.

I've got my values defined in the ShapeSheet as shown in your file, but how do I create the data set and make it reference the values I just made in the ShapeSheet?

Also, each one has a field with the label and name of A.  Is that needed?

Do I put thepage!prop.myListValues in the format box?  If I do that, it just makes that the only option.  I'm not sure where to put that formula.

Thanks!


blairmc98

I appreciate your help!

I am still missing something.  See attachment.  I can get the list created on the page, but when trying to make the rectangle's data field reference that list, all I get is what I typed in the field.  I'm sure I'm doing something wrong.

Also, am I supposed to type what is in the Value field too?

Thank you for being so patient with me!

Yacine

I'm pretty sure the formula in the format cell is between quotation marks.

Also change the field type of the listValues prop in the page's shapesheet to 0 - not 1. The comma separated list goes in the value field, not the format field.
Yacine

blairmc98

I'm still doing something wrong.

I've changed the type on the page's shape data to 0 - String.

When I type ThePage!Prop.listValues into the format field of the rectangle, nothing happens and I just end up with ThePage!Prop.listValues as the only entry in a drop down.  After doing that, if I double click the format field, this is what is in there:

="ThePage!Prop.listValues"

I understand exactly what you've done (make it reference a string list that doesn't get recreated when you change it), I just don't know how to go about replicating it!  I can't seem to get the order of the steps right.

Yacine

Quote from: Yacine on August 04, 2017, 05:05:22 PM
I'm pretty sure the formula in the format cell is between quotation marks.
Remove them, otherwise the formula won't get interpreted.
Yacine

blairmc98

Success!

I was also removing the = as well and only had the text in the field, and I guess it took that as a literal string.

I can't thank you enough for your help and patience!  I appreciate it!

blairmc98

Is there a way to make Visio reference an external source, like an excel file, for these lists, so I can use them across multiple files?

Thanks!