Visio Guy

Visio Discussions => ShapeSheet & Smart Shapes => Topic started by: Visisthebest on November 22, 2021, 10:26:49 AM

Title: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 22, 2021, 10:26:49 AM
I was wondering what mechanism Visio uses to escape characters used for semicolon-separated lists.

When testing with variable lists in shape data, whatever I try:
;;
;;;
";"

it seems using a semicolon in a list item is not possible because there is no way to escape a semicolon in an item string.

Is this possible in any way?

Visio does allow to escape the double quotes " after all.

Thank you for sharing your insights in Visio!
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Paul Herber on November 22, 2021, 10:58:58 AM
CHR(59)
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 22, 2021, 12:33:50 PM
Super Paul thank you!
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 22, 2021, 12:55:52 PM
If I create a list like this in the Format cell:

=";"&CHAR(59)&"AA;BB"

it still does not show a ; in the dropdown, it doesn't escape the ; character treats it as a separator still.

How to show a ; in a list item in a Shape Data dropdown.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: wapperdude on November 22, 2021, 02:49:02 PM
Don't think it's possible.  But, I did not explore if Visio lets you define something other than semicolon as the separator.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 22, 2021, 08:47:21 PM
It is good to know that this is just a rule: no semicolon in Shape Data lists.

I don't think you can configure this for shape data lists or anything else where semicolons are used, probably too many diagrams would break if you configure another separator.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Yacine on November 23, 2021, 08:06:28 AM
A workaround: use another character and replace it by the actual semicolon when needed .
list = "a;b;|"
user.xy = replace(list,"|",";")
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 23, 2021, 08:42:19 AM
Thank you Yacine!
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Surrogate on November 23, 2021, 08:49:32 AM
Quote from: Yacine on November 23, 2021, 08:06:28 AM
user.xy = replace(list,"|",";")
IMHO there you must use SUBSTITUTE function (https://docs.microsoft.com/en-us/office/client-developer/visio/substitute-function) with syntax
SUBSTITUTE (text,old_text,new_text,[start_num],[ignore_case_opt])
instead REPLACE (https://docs.microsoft.com/en-us/office/client-developer/visio/replace-function-visioshapesheet) with syntax
REPLACE (old_text,start_num,num_chars,new_text)
Sorry Visisthebest, i cant understand what is your issue and purpose !
When i use workaround by Yacine and formula ";"&CHAR(59)&"AA;BB", i get same result.
(https://i.imgur.com/1FzF6XO.png)
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Surrogate on November 23, 2021, 09:55:56 AM
Quote from: Visisthebest on November 22, 2021, 10:26:49 AM
Thank you for sharing your insights in Visio!
Not Visio insight  ;)
Just use symbol which looks like semicolon, for example Greek Question Mark (https://www.compart.com/en/unicode/U+037E)
(https://savzen.files.wordpress.com/2013/03/punctuation-mark_page_06.jpg?w=300&h=212)
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 23, 2021, 10:31:00 AM
Also a clever workaround Surrogate!
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: wapperdude on November 23, 2021, 03:17:22 PM
@Visisthebest:  Why do you want to do this anyway?  Seems that there's no real functionality, but rather, an intellectual curiosity.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 23, 2021, 03:39:39 PM
No there is an important reason and it has to do with the INDEX function used in the lookup lists.

I use Excel .XLSX files that have a specific format for creating diagram configuration data, users can upload these configurations in to Visio for the Shape Data lookups.

Now if a user changes the order of a list in Excel, then updates the Visio diagram, suddenly for instance, item 1 and 2 have been switched around.

This will lead to confusion as it seems there is a data entry error (that happened in the Visio shape data editor), but because shape data lists use the INDEX function the actual item chosen is not preserved, just its position in the list (which is now switched around).

This way, by storing every change a user makes (the actual item chosen, not just its INDEX position), I can see where things went haywire.

Users are of course instructed about this, but users are champions in not reading and/or forgetting instructions (I am also very good at this when it comes to someone else's product;). Better have a backup plan.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: wapperdude on November 24, 2021, 07:23:48 PM
I understand the explained issue, but, not correlating it to the ";" issue.  But, that's OK.

Regarding the User following instructions issue, might you put a conditional statement to issue a warning by checking existing entry vs selected?...and ask user to proceed?  Might be a challenge for shapesheet only solution, but feels doable.  Obviously, could do it with code.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: Visisthebest on November 25, 2021, 05:25:26 AM
You're right wapperdude that was actually about my question here, I answered it for the wrong question: http://visguy.com/vgforum/index.php?topic=9712.0

But also for escaping the semicolon character, I prefer not to have to say to customers you can't use a semicolon in any of the text for shape data lists, because the underlying software can't properly escape the semicolon character.

I will probably make the shape data lists editable only via Excel, not in shape data, and when the user updates Visio give a warning that all semicolons are automatically removed (if there are any), that makes sure the end users knows what's happening.
Title: Re: Variable List Shape Data - any way to escape the ; character
Post by: wapperdude on November 25, 2021, 07:34:23 PM
QuoteBut also for escaping the semicolon character, I prefer not to have to say to customers you can't use a semicolon in any of the text for shape data lists, because the underlying software can't properly escape the semicolon character.

Not sure how you've implemented this, but a copy/paste text string, with semi's, into the prop.format cell works fine.  Can be done manually or with code.