Author Topic: Formula in ShapeSheet|ShapeData|Label prevents multiple changes of ShapeData  (Read 635 times)

0 Members and 1 Guest are viewing this topic.

kuempsjack

  • Newbie
  • *
  • Posts: 5
Hello,
I have developed a master shape "Box" with 2 main functions:

Function 1: Multiple Change of Shape Data
"Box" has several shape data, most of them are fixed lists, like a "Box Size" with the items "small,middle,big".
Usually on one page there are many of the "Box" shapes, and the user can do a mass change by selecting them and choosing another item of the fixed list. The reason why this is possible is, that for all shapes the label has the same name, here "Box Size".

Function 2: Formula in Label
Now I wanted to use a Formula in ShapeSheet|ShapeData|Label, so instead of the fixed text "Box Size" I would like to change the name according to a "global variable", the language: =IF(STRSAME(TheDoc!User.Doc_Language,"DE"),"Box Groesse","Box Size"). This works quite well.

Problem:
The problem is, that as soon the ShapeSheet|ShapeData|Label is filled with a Formula instead of a text string, a multiple change of shape data is not possible anymore.

Has anybody an idea how to combine both functions in the same shape?

Many thanks for your ideas in advanced!

Best regards,
kuempsjack





vojo

  • Hero Member
  • *****
  • Posts: 1513
As far as I know, shape data is static..no actual functions

You can put a various functions in user cell the use shape data to trigger which ones fire
You could try to use the user function construct in user cells....but not sure how dymanic it can be

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3821
  • Ideas Visio-lized into solutions
Visio doesn't like the formula as you discovered.  But if you use the setf, getref construct to push the desired label string into the data label cell, that will work.
Visio 2019 Pro

Croc

  • Full Member
  • ***
  • Posts: 246
    • Visioport
You can duplicate ShapeData. Let there be both “Box Groese” and “Box Size”. But one property will be visible and the other hidden.
In the Invisible cell, there should be a formula like = IF (STRSAME (User.Doc_language, "DE"), TRUE, FALSE)

Croc

  • Full Member
  • ***
  • Posts: 246
    • Visioport
Sorry ...
More precisely will do so

kuempsjack

  • Newbie
  • *
  • Posts: 5
thanks for your ideas so far, it gives me hope  :)

I am currently trying to implement wapperdude's idea, as it sounds more easy than croc's one.

But I do not get it running, it's the first time I have heard of the SETF-GETREF-construct.

What I do not know is, what could be the trigger, that the label ist changed?
As first idea I thought of EventDblClick to test the Formula (see Picture below), but even this is not working. The string is not pushed to the label, when I do a double click on the shape.

The Formula I tried is: =SETF(GetRef(Prop.Box_Size.Label),IF(STRSAME(TheDoc!User.Doc_Language,"DE"),"Box Groesse","Box Size"))


wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3821
  • Ideas Visio-lized into solutions
You need triple quotes, each,  around the two label strings...e.g., """Box Size"""
Visio 2019 Pro

kuempsjack

  • Newbie
  • *
  • Posts: 5
great, now it works :D Thanks a lot!

The formula looks now like this: =SETF(GetRef(Prop.Box_Size.Label),IF(STRSAME(TheDoc!User.Doc_Language,"DE"),"""Box Groesse""","""Box Size"""))

And I already tested, also the Function 1: Multiple Change of Shape Data is working.

My only open question is now where to put this Formula? What could be the trigger?
The EventDblClick does not make sense, as there a around 1000 shapes in one document, and each shape has ca. 20 labels to be changed :)

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3821
  • Ideas Visio-lized into solutions
I'm not a good "events" guy... but this seems like possiblely a page event, or even a doc open event?  Really depends upon how often you'd like it triggered, and what conditions needed.  If it's a manual event, you might even put a shape / button on the page as the trigger.
Visio 2019 Pro

kuempsjack

  • Newbie
  • *
  • Posts: 5
usually the language is not changed often, so a page event is a good idea. but how to adress the 1000 shapes that are lying on one page?

Alternatively, after playing around a Little bit a workaround could be to use EventFXMod, and then after a language change mark all shapes, change the XY-position and then change it back.

kuempsjack

  • Newbie
  • *
  • Posts: 5
Problem is solved now!

I just put the forumla in the User-definded Cells section, instead of in the Events section. Now the language changes as soon as the global variable is changed.

What helped me to understand Events better was reading https://flylib.com/books/en/2.268.1.44/1/