getPage/getResources: Escape Character for Comma in &tvFilters

Good morning,
I’m working with getPage/getResources to retrieve pages identified by a comma-separated list of resource ids from an auto tag. The challenge I’m facing is with the &tvFilters, where the commas in my list are being interpreted as AND conditional operators rather than mere delimiters.

Here’s my getPage code:


Here’s a breakdown of &tvFilters, so it is easier on the eyes:

  1. autotagTV = [[*id]] - exact match
  2. autotagTV = [[*id]],% -array begins with targeted id
  3. autotagTV = %,[[*id]] -array ends with targeted id
  4. autotagTV = %,[[*id]],% -targeted id is in the middle of the array

The auto tag has a input type of “Listbox (Multi-Select)” with the dropdown options of:

@SELECT `pagetitle`,`id` FROM `[[+PREFIX]]site_content` WHERE `deleted`=0 AND `template`=23 ORDER BY menutitle

I’ve tried using escape characters like forward slash, backslash, and the HTML encoding for comma &#44, but none of these have worked.

Would anyone know of an escape character that I could use so that &tvFilters will interpret the comma as a character rather than the AND operator? I’m aware that changing the delimiter in the auto tag TV is an option, but it would be time-consuming to patch it at other places, and I’d prefer to avoid it if there’s a simpler solution available.

Thanks for your time,

I’ve not seen documentation supporting the use of commas like that in the tvFilters

Would the following not cover all eventualities?


There is a property &tvFiltersAndDelimiter that you can set to use something else than the , character in the &tvFilters strings as the AND delimiter.

Hi dejaya,

Thanks for the suggestion, but that option would unwanted resources. For instance, if I was seeking resource id of 5, %[[*id]]% would return 5, 55, 25, 555, 52, etc.

Hi halftrainedharry,

thanks you! I didn’t know that property existed. It is certainly what I’m looking for. However, it isn’t working. I’ve tried getPage, getResources and pdoPage. No dice. I’m going to keep at it and post if I find a solution.


With this input type, the values in the database are not comma-separated, but separated by double pipes (||). (Check the values in the database table modx_site_tmplvar_contentvalues to confirm this.)

So you probably have to change your filter string and (and maybe set the property &tvFiltersOrDelimiter instead):


Thank you so much! You solved the issue. I was completely unaware that the autotags were separated by double-pipes in the database.


Thanks again! This issue has been on my backburner for awhile now. I was using a very hacky way around it by filtering within the tpl. As you can imagine that caused loads of performance issues. Now pages are loading swiftly.

Have a great weekend,

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.