Hi,
I've got an driver that returns an config string from an device. These strings look like this:
00010203
01010203
0C0D0E0F
etc, basically it comes down to added HEX values:
so it is device config string parameter 1 2 3 4 -> 00,01,02,03
now i want to show or hide a few shapes based on an parameter. paramer 1 for instance can be between 00-0f so i need to match the first two digits. For the second paramter i need to match the second set of two digits. and for the third parameter i need to match the 3th set etc.
How can i do this within an visio?
Hi Gerwin,
An option could be to use regex to parse the HEX values into each pair of digits.
In Visio, you can achieve this by using the option [RegexReplace:x,y,z] | DataMiner Docs
And then for the regular expression you can use ([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})
And then depending on the parameter you want you can use for the string that will replace each of the matches either $1 or $2 or $3 or $4 depending on whether you want the 1st, 2nd, 3rd, or 4th respectively.
Hi,
Could you confirm if there is a typo in your comment? As I see 07, after the regex expression and only 1 %.
Additionally, could you try on a separate shape to have just the original input without using any placeholders? This could be helpful to verify if any other [Sep] are needed.
Re-reading your original question a doubt came to my mind.
Is your input 00010203 or does it contain ,? Like 00,01,02,03?
If it is the first then the original expression should work (https://regex101.com/r/nQN09b/1) otherwise if it should contain the , then you should use ([0-9a-fA-F]{2}),([0-9a-fA-F]{2}),([0-9a-fA-F]{2}),([0-9a-fA-F]{2}) (https://regex101.com/r/nQN09b/2)
There is a typo but i think it’s an html issue[RegexReplace:[Sep:,%]([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})07,[cardvar:acp_slot]/#Emb1_Ch01/04%$1]
so after the last ([0-9a-fA-F]{2}) there is an % 3007, (but without the space)
I try to access the paramter/displaykey: 3007,[cardvar:acp_slot]/#Emb1_Ch01/04 that’s why i did the Sep:,%
Could it be that you are missing a [param:] placeholder around the part where you try to access the parameter/displaykey?
Something like
[RegexReplace:[Sep:,%]([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})%[param:*,3007,[cardvar:acp_slot]/#Emb1_Ch01/04]%$1]
Hi i tried that, but i’m still getting the whole string back. I’ve got an shape with * as text and a Parameter shape data with the following:
[RegexReplace:[Sep:,%]([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})07,[cardvar:acp_slot]/#Emb1_Ch01/04%$1]
i figured i needed to use the Sep cause of the variable has an pid/key combo. However i still get the whole string back.