<![CDATA[ pdoResources and tvFilters - My Forums]]> https://forums.modx.com/thread/?thread=92071 <![CDATA[pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters?page=2#dis-post-502931
[[!pdoResources? 
    &parents=`1`
    &limit=`1`
    &tpl=`popularTripsTpl` 
    &tvFilters=`featured==1`
    &includeTVs=`tripthumb,mml_pagetitle,mml_introtext,featured,count-trips` 
    &prepareTVs=`1`
    &loadModels=`migxmultilang`
    &prepareSnippet = `mmlTranslatePdoToolsRow`
    &showLog=`1`
]]


A very similar listing using a TV to orderby works fine:
[[!pdoResources? 
    &parents=`1`
    &limit=`3`
    &tpl=`popularTripsTpl` 
    &sortby=`count-trips`
    &sortdir=`DESC`
    &includeTVs=`tripthumb,mml_pagetitle,mml_introtext,count-trips` 
    &prepareTVs=`1`
    &loadModels=`migxmultilang`
    &prepareSnippet = `mmlTranslatePdoToolsRow`
]]


The log output:
0.0002019: pdoTools loaded
0.0000432: Loaded model "migxmultilang" from "/core/components/migxmultilang/model/"
0.0000498: xPDO query object created
0.0000701: Added TVs filters
0.0007250: Included list of tvs: mml_pagetitle, mml_introtext, tripthumb, count-trips, featured
0.0005169: leftJoined modTemplateVarResource as TVmml_pagetitle
0.0005069: leftJoined modTemplateVarResource as TVmml_introtext
0.0004590: leftJoined modTemplateVarResource as TVtripthumb
0.0005240: leftJoined modTemplateVarResource as TVcount-trips
0.0004590: leftJoined modTemplateVarResource as TVfeatured
0.0007908: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
0.0000191: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.mml_pagetitle`
0.0000150: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.mml_introtext`
0.0000141: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.tripthumb`
0.0000150: Added selection of modTemplateVarResource: IFNULL(`value`, '0') AS `tv.count-trips`
0.0000150: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.featured`
0.0000808: Replaced TV conditions
0.0008380: Processed additional conditions
0.0015631: Added where condition: 0=`TVfeatured`.`value` LIKE '1', modResource.parent:IN(1,18,19,20,21,22,23,24,25), modResource.published=1, modResource.deleted=0
0.0000470: Replaced TV conditions
0.0002229: Sorted by modResource.publishedon, DESC
0.0000081: Limited to 1, offset 0
0.0004170: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVmml_pagetitle`.`value`, '') AS `tv.mml_pagetitle`, IFNULL(`TVmml_introtext`.`value`, '') AS `tv.mml_introtext`, IFNULL(`TVtripthumb`.`value`, '') AS `tv.tripthumb`, IFNULL(`TVcount-trips`.`value`, '0') AS `tv.count-trips`, IFNULL(`TVfeatured`.`value`, '') AS `tv.featured` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_pagetitle` ON `TVmml_pagetitle`.`contentid` = `modResource`.`id` AND `TVmml_pagetitle`.`tmplvarid` = 1 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVmml_introtext` ON `TVmml_introtext`.`contentid` = `modResource`.`id` AND `TVmml_introtext`.`tmplvarid` = 4 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVtripthumb` ON `TVtripthumb`.`contentid` = `modResource`.`id` AND `TVtripthumb`.`tmplvarid` = 8 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVcount-trips` ON `TVcount-trips`.`contentid` = `modResource`.`id` AND `TVcount-trips`.`tmplvarid` = 9 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVfeatured` ON `TVfeatured`.`contentid` = `modResource`.`id` AND `TVfeatured`.`tmplvarid` = 10 WHERE  ( `TVfeatured`.`value` LIKE '1' AND `modResource`.`parent` IN (1,18,19,20,21,22,23,24,25) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 )  ORDER BY modResource.publishedon DESC LIMIT 1 "
0.0001550: SQL executed
0.0001361: Total rows: 0
0.0000169: Rows fetched
0.0000391: Prepared and processed TVs
0.0000010: Returning processed chunks
0.0073311: Total time
13 631 488: Memory usage
]]>
sottwell Jul 12, 2014, 07:01 AM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters?page=2#dis-post-502931
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters?page=2#dis-post-559282
[[pdoResources?
    &parents=`0`
    &includeTVs=`homepageFeatureCheckbox` 
    &where=`{"homepageFeatureCheckbox.value":"true"}` 
    &prepareTVs=`1`
    &tpl=`tl.pr.news-feature`
    &limit=`4`
    &sortby=`{"publishedon":"DESC"}`
    &includeContent=`1`
]]
]]>
BobRay Jun 28, 2018, 05:25 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters?page=2#dis-post-559282
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-559261 sottwell had already written.

[
[pdoResources?
	&parents=`0`
	&includeTVs=`homepageFeatureCheckbox` 
	&where=`{"homepageFeatureCheckbox.value":"true"}` 
	&prepareTVs=`1`
	&tpl=`tl.pr.news-feature`
	&limit=`4`
	&sortby=`{"publishedon":"DESC"}`
	&includeContent=`1`
]


My TV is a simple checkbox within a News post, which is set that if it's checked it will return true. This will then pull up to 4 articles which are selected as true, and provide a Featured News section, for, in my case, the homepage.]]>
mattgh9152 Jun 27, 2018, 10:14 AM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-559261
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-535734 davidsmith Dec 11, 2015, 04:50 AM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-535734 <![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-535436 https://rtfm.modx.com/extras/revo/getresources#getResources-SelectionProperties

It seems the "==" operator doesn't cast the input type. For the numerical value of the checkbox I was trying to set to 1 or 0 (zero) I had to use the === operator to get the type cast to numerical. Then it worked, and I imagine Sotwell's original problem would be solved.

I have a new, related problem: it seems pdoResources might not know about all the new operators, and it doesn't appear to honour default values. So if you have a single checkbox and it's supposed to represent 0 when unchecked and 1 when checked, the default that is presumably null won't be detectable as 0, and you can't then use the other operators (<=> "null safe equals"?) to find the ones that are supposed to be 0 (zero).

I'm still testing this issue, in an attempt to make this work without needing to go back to getResources.]]>
davidsmith Dec 05, 2015, 03:23 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-535436
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513666
[[!pdoResources? &parents=`20,10` &depth=`0`  &limit=`1` &tpl=`dateTpl` &includeTVs=`eventDate` &processTVs=`1` &where=`{"eventDate:>":"[[!currentDate:date=`%Y-%m-%d`]]"}` &sortby=`eventDate` &sortdir=`ASC`]]


I added the snippet uncached - initially that didn't work because I have another call doing much the same which was cached, both have to be uncached in order to work.

The call for the tv simply needed to the name of the tv, in my case eventDate and then it worked! Many thanks for your input.]]>
boomerang Oct 29, 2014, 04:08 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513666
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513663
%Y-%m-%d 00:00:00


so, IMO, it should work, also TV-filters should do it.

and in any case your snippet should be called uncached

[[!currentDate:date=`%Y-%m-%d 00:00:00`]]


also pdoResources should be called uncached in that case.

but I think, that isn't the issue here.]]>
Bruno17 Oct 29, 2014, 02:09 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513663
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513662
No joy.

EDIT: Actually when I check again my dateTpl doesn't output a unix timestamp so I'll check this properly. My snippet does though smiley]]>
boomerang Oct 29, 2014, 01:34 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513662
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513661
&where=`{"TVeventDate.value:>":"[[currentDate:date=`%Y-%m-%d 00:00:00`]]"}`
]]>
Bruno17 Oct 29, 2014, 12:30 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513661
<![CDATA[Re: pdoResources and tvFilters]]> https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513660 sottwell Oct 29, 2014, 12:21 PM https://forums.modx.com/thread/92071/pdoresources-and-tvfilters#dis-post-513660