pdoResources and checking total value


I have pdoResources returning the number of records using &setTotal=1 and if I add [[+total]] to my code, it correctly shows the number of entries.

I am trying to test the value to vary what is shown depending on the value of [[+totals]] but nothing seems to work. I have tried the if using output modifiers and the If addon – can you see if you can get it to work?

I have:

Total: [[+total]]

[[+total:greaterthan=`0`:then=`SHOW ME`:else=`HIDE ME`]]

which shows:

Total: 2

Is +total a different data type as it does not have a length (not a string) and cannot be compared?


Can you show a sample of your entire snippet call / code?

I tested this by putting the below directly into an empty resource and it outputted SHOW ME (as well as a list of the resources) as I would have expected.

[[+total:greaterthan=`0`:then=`SHOW ME`:else=`HIDE ME`]]

The code is supposed to show the other art from the artist. This is in the Art template.
I have:

	&where=`{ "ArtistsID:=" : "[[*ArtistsID]]", "AND:artid:!=" : "[[*artid]]" }`

<p>  Total: [[+total]]</p>
<p>[[+total:greaterthan=`0`:then=`SHOW ME`:else=`HIDE ME`]]</p>


The where links the artists and the art together and the second part excludes the current page thjat we are on from the listing. This is displayed by MoreListings and works fine.

For Total, I am getting 1 and HIDE ME

Logs are:

0.0000751: pdoTools loaded 0.0000210: xPDO query object created 0.0006931: Included list of tvs: **artid, ArtistsID, ArtTitle** 0.0001431: leftJoined *modTemplateVarResource* as **TVartid** 0.0000870: leftJoined *modTemplateVarResource* as **TVartistsid** 0.0000830: leftJoined *modTemplateVarResource* as **TVarttitle** 0.0001402: Added selection of **modResource** : <small>SQL_CALC_FOUND_ROWS id, type, contentType, pagetitle, longtitle, description, alias, alias_visible, 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</small> 0.0000069: Added selection of **modTemplateVarResource** : <small>IFNULL(value, '') AS tv.artid</small> 0.0000050: Added selection of **modTemplateVarResource** : <small>IFNULL(value, '') AS tv.ArtistsID</small> 0.0000041: Added selection of **modTemplateVarResource** : <small>IFNULL(value, '') AS tv.ArtTitle</small> 0.0000260: Replaced TV conditions 0.0004599: Processed additional conditions 0.0006661: Added where condition: **TVartistsid.value:==4, AND:TVartid.value:!==A23, modResource.parent:IN(6,7,8,9), modResource.published=1, modResource.deleted=0** 0.0000100: Replaced TV conditions 0.0000720: Sorted by **TVartid.value** , **ASC** 0.0000019: Limited to **10** , offset **0** 0.0003080: SQL prepared <small>"SELECT SQL_CALC_FOUND_ROWS modResource.id, modResource.type, modResource.contentType, modResource.pagetitle, modResource.longtitle, modResource.description, modResource.alias, modResource.alias_visible, 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(TVartid.value, '') AS tv.artid, IFNULL(TVartistsid.value, '') AS tv.ArtistsID, IFNULL(TVarttitle.value, '') AS tv.ArtTitleFROMmodx_site_contentASmodResourceLEFT JOINmodx_site_tmplvar_contentvalues TVartidONTVartid.contentid=modResource.idANDTVartid.tmplvarid= 11 LEFT JOINmodx_site_tmplvar_contentvalues TVartistsidONTVartistsid.contentid=modResource.idANDTVartistsid.tmplvarid= 13 LEFT JOINmodx_site_tmplvar_contentvalues TVarttitleONTVarttitle.contentid=modResource.idANDTVarttitle.tmplvarid= 9 WHERE (TVartistsid.value= '4' ANDTVartid.value!= 'A23' ANDmodResource.parentIN (6,7,8,9) ANDmodResource.published= 1 ANDmodResource.deleted= 0 ) ORDER BYTVartid.value ASC LIMIT 10 "</small> 0.0017581: SQL executed 0.0001910: Total rows: **1** 0.0000219: Rows fetched 0.0046301: Prepared and processed TVs 0.0026400: Loaded "modChunk" with name "ArtListing" 0.0030320: Returning processed chunks 0.0121272: **Total time** 4 194 304: **Memory usage**