Visio formulae can get quite complex and you can sometimes find yourself writing long strings across multiple shapes to achieve a particular outcome. I thought I’d jot down a quick post about one helpful tool, which I came across via Scott Hanselman’s annual(ish) tools list, called NimbleText.
NimbleText is a free tool that allows you to parse and manipluate text and is a great help for getting your strings into a Visio consumable state.
50 States
Here’s an example – suppose you want to get a list of US States and combine them so you get a state name / color pairing. Being a shocking Geography student, you take yourself off to Wikipedia and copy the ‘States’ table.
Of course what you get is the whole table, but this is no problem to NimbleText:
If you look at the above screenshot you can see that NimbleText works by dividing your data into Rows and Columns. The UI is divided into three areas – the top is you original string, the middle is the pattern you want to apply (to each row) and the bottom is the result.
I’ve set the row separator to be a newline (‘\n’) and the columns separator to be a tab (‘\t’). Once your structure’s set you can use some of the included keywords and functions in the pattern panel to determine your output.
As you can see I’ve used the first column keyword (‘$0’) in my pattern and what this is really saying is:
for each row in my data, take the item in the first column and output it to the Results panel followed by a semi-colon.
So at this stage you’ve got a list of semi-colon separated State names and you can add them to a User cell in Visio:
The next step is to either add a second cell of corresponding delimited colors or, include it all in single list I’m going to take the latter option.
Now, if you had a pre-defined set of colors you could introduce that here, but I’m going to generate some random RGB values to show off that, aside from the built-in keywords and functions, NimbleText can also accept custom JavaScript in the pattern panel as well. All you need to do is bracket off your code in a <% code %> combination and it will be executed within the output loop. So adding that to the pattern produces, both the State name and an associated RGB, separated by a pipe character.
Back in Visio you could use the list data as follows:
…which would produce these results:
I think this a great tool and while I’m sure there are lots of applications that manipulate text in this way - I just haven't found one I like as much as this.