Re: "where" clause in dynamicdata getitems

Ryan Walker <[email protected]> Wed, 08 Oct 2008 09:00:21 -0400
Newsgroups gmane.comp.cms.xaraya.user
Message-ID <[email protected]>
Marty Vance wrote:
> Ryan Walker wrote:
>   
>> Hi all,
>>
>> I can't figure out the syntax for a "where" clause in the following 
>> example...
>>
>> <xar:set name="where">'signed_up_as eq \'org\''</xar:set>
>> <xar:set 
>> name="items">xarmodapifunc('dynamicdata','user','getitems',array('modid' 
>> => 151, 'itemtype' => 61, 'where' => $where))</xar:set>
>> <xar:foreach in="$items" key="$key" value="$val">
>> <xar:set name="$aids[]">$key</xar:set>
>> </xar:foreach>
>> <xar:set name="pop">array_pop($aids)</xar:set>
>> <xar:set 
>> name="org_signers">xarmodapifunc('articles','user','getall',array('ptid' 
>> => 61, 'fields' => array('title','summary','dynamicdata'), 'aids' => 
>> $aids, 'sort' => 'title ASC', 'where' => 'status eq 2'))</xar:set>
>>
>> I've tried the following...
>>
>> <xar:set name="where">'signed_up_as eq \'org\''</xar:set>
>>
>> <xar:set name="where">'signed_up_as = \'org\''</xar:set>
>>
>> <xar:set name="where">'signed_up_as eq org'</xar:set>
>>
>> <xar:set name="where">'dd_534 eq \'org\''</xar:set>
>>
>>     
>
> It looks like you're tring to do the same thing via articles and dd.
>
> artices_userapi_getall has a param that you may have overlooked: 
> wheredd.  The where param doesn't work for dd fields.
>
> <xar:set 
> name="org_signers">xarmodapifunc('articles','user','getall',array('ptid' 
> => 61, 'fields' => array('title','summary','dynamicdata'), 'aids' => 
> $aids, 'sort' => 'title ASC', 'where' => 'status eq 2', 'wheredd' => 
> 'signed_up_as eq \'org\''))</xar:set>
>
> I don't think I've ever used wheredd, but that should work if I 
> understand correctly what you're doing.
>   
I found something in the bug tracker that mentions a patch to implement 
the "wheredd" parameter, but it's not something that has been 
implemented... at least not in Xaraya 1.1.3.  I guess I could try that 
patch, but I like to stick with the functionality in the normal Xaraya 
releases.  So I figured I would use dynamicdata getitems to get a list 
of itemids and then feed those itemids to the articles getall function.  
I just can't seem to get the "where" clause to work in the dynamicdata 
getitems function.

-Ryan


-- 
Ryan Walker
www.WebCommunicate.net:
Insights and resources for effective websites.