We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17249 ☆ A M B ☆
    • 165 Posts
    I used this simple line in InputOptions to get all distinct values from TV id 7 which is working ok.
    What is its xPDO form to use the result in a snippet?

    @SELECT DISTINCT `value` FROM `modx_site_tmplvar_contentvalues` WHERE `tmplvarid` = 7
    



    Tried with:

    
    <?php
    /* Get distinct values from template variable giving its Id  */
    
    
    $output ='';
    
    
    
    $c = $modx->newQuery('modTemplateVar');
    $c->select('DISTINCT '.$modx->getSelectColumns('modTemplateVar','','',array('id','value')));
    $c->where(array(
          'tmplvarid' => 3,
    ));
    $collection = $modx->getCollection('modTemplateVar', $c);
    
    $output = count($collection);
    
    return $output;



    count is 0.
    Thanks in advance. [ed. note: lithiumlab last edited this post 14 years, 11 months ago.]