Drill Down URL - Encoding of Values

27311

I'm attempting to "roll my own" data visualization component by pulling data using the XML link for a view.

The component will have a drill through capability, just like the native data visualizations. I am trying to recreate the drill though link, but noticing some odd behavior with the url encoding.

Let's say I click on a standard bar chart for "Miami, FL".  The drill through URL is:

metaData.siteID=1&metaData.sheetId=2&metaData.sheetViewID=3&advanceSearch=true&exactSearch=true&filterValue_111_3=Miami%5E%5E%20FL

Note that exactSearch=true is included, and the comma in "Miami, FL" is replaced with %5E%5E, which is ^^.  Why is the comma replaced?

If I run an advanced search filtering on "Miami, FL", the URL is different:

sheetHome.action?metaData.siteID=1&metaData.sheetId=2&metaData.sheetViewID=3&advanceSearch=true&filterValue_111_3=Miami%2C%20FL

There is no exactSearch parameter and the comma is retained as %2C

From testing I realized that I must include exactSearch=true.  If I don't include that parameter and I filter on a value like "New York", then the results will include similar values, like "New Hampshire".  (You can see that when running an advanced search.)

The problem becomes if I am filtering on a value like "Miami, FL" that contains a comma.  To construct my drill down url I am simply using the native encodeURIComponent() function of JS on the value.  Therefore, "Miami, FL" becomes "Miami%2C%20FL".  But if my drill down URL is constructed as:

metaData.siteID=1&metaData.sheetId=2&metaData.sheetViewID=3&advanceSearch=true&exactSearch=true&filterValue_111_3=Miami%2C%20FL

with exactSearch=true but replacing the comma with %2C, no results are returned.

I need to understand the rules for constructing the drill down URL when exactSearch is included:  how do the values in the URL parameters need to be encoded?  The only rule I have found is replacing a comma with %5E%5E.

  • Hi Mark Salamon, I think the comma should be the only rule you need to worry about. As this is a choice field you are talking about, when selecting multiple choices, they are separated by comma's. This has always been a complete pain when the choice value itself contains a comma (DocAuto templating especially).

    They are obviously translating comma's in the choice value itself (when exactSearch=true) to get around this long-standing limitation.

  • Andrew Quinn thanks! do i only need to worry about this for choice field values and not text values?

  • Mark Salamon, the same logic seems to apply to SingleLineText fields but probably because this (exactSearch param) works agnostically. For SingleLineText fields, when searching using Advanced, looking for Miami, FL will actually look for any records with Miami or FL (punctuation is superfluous and is ignored). However, if you enclose in double quotes, then we can exact match, e.g.

    https://...?metaData.siteID=1&metaData.sheetId=2&metaData.sheetViewID=3&advanceSearch=true&filterValue_112_1="Miami%2C%20FL"

     

  • Andrew Quinn I noticed that when I put quotes around the information in the URL I get no results.

  • Mark Salamon, without knowing more specifics about your data, what you are searching, and the format of the url, I can't really comment further. I have, however, created a simple iSheet with screenshots that may or may not help as reference. The screenshots are:

    1. Standard iSheet view
    2. Adv. Search on SingleLineText field for Miami, FL
    3. Adv. Search on SingleLineText field for "Miami, FL" - i.e. exact match

    See attached