URL Encoding in MDX
Been a bit busy this week, so only a short entry but hopefully a useful one. Continuing my series on undocumented new features in AS2005, I present the URLESCAPEFRAGMENT function which performs url encoding on a string. Here’s an example of how it works:
SELECT MEASURES.TEST ON 0
FROM [Adventure Works]
It returns the following result set:
Why on earth do you want to do this though? Well I came across a problem last year when I was creating actions that created dynamic urls. I wanted to embed a unique name inside my url and realised that all those square brackets and ampersands needed to be replaced with escape characters, and couldn’t find an easy way of doing this (the only option seemed to be to do some custom coding). However the guys on the dev team were way ahead of me and as soon as I asked about this problem, they told me about this function.