XML Datasource Record Filter Dynamic GET Input not working with spaces

(Nic Hubbard) #1

Matrix Version:

We are using the XML Datasource Record asset and doing some dynamic filtering based on a GET variable. We are filtering on a “department” field which sometimes has a space in it, e.g. “Visual Arts”. However, when the GET var is processed, it doesn’t work because that space is encoded in the URL.

I have also tried using POST but that doesn’t work either.

Does anyone have any ideas on a way around this encoding issue?

(Bart Banda) #2

Instead of using a GET variable can you use Set Value and use a keyword together with a keyword replacment?

%globals_get_department^replace: :% 


(Nic Hubbard) #3

Doesn’t work.

Somehow the value is still getting messed up. If I enter “Visual Arts” into the “Value to Match” it works correctly, but using the %%department%% replacement doesn’t work, even with the Set Value suggestion.

It seems somehow the matching is incorrect when it seems it shouldn’t be.

Is there any way to see the actual string that is being matched in php?

(Bart Banda) #4

Strange. Have you tried using a different Match Type? For example Contains or Regex match just to see if you get a different result?

(Nic Hubbard) #5

Yes, have tried all combinations. Here are my settings:

Not sure if you have time to test it…

(Bart Banda) #6

Thanks, any chance you could export it to XML and upload here (or somewhere else if discourse doesn’t allow those file types) so that we can download and import, replicate, and test easier?


Matrix version

Getting same issue using JSON datasource, select frontend with values like

<option value="Occupational Medicine">Occupational Medicine</option>
<option value="Occupational Physician">Occupational Physician</option>

works for single words but not for anything with spaces.
Don’t have time to wait on this one (unless there’s a quick fix) so going to try filtering in ssjs but figured I should report.