Search code examples
attask

AtTask REST API 'OR' Query?


Is there any way to perform an 'OR' on the same field in the query string. I'm trying to search for project status of either current 'CUR' or a custom one.


Solution

  • You would do this by prefixing OR:a: before the different clauses.

    status=CUR
    status+Mod=eq
    OR:a:status=PLN
    OR:a:status_Mod=eq
    

    continue if required

    OR:b:...
    

    Note that each block is run independently of any other. This means that you need to repeat anything that is in common with all of them. The OwnerID would need to be in each block like below.

    status=CUR
    status+Mod=eq
    ownerID=$$USER.ID
    ownerID_Mod=eq
    OR:a:status=PLN
    OR:a:status_Mod=eq
    OR:a:ownerID=$$USER.ID
    OR:a:ownerID_Mod=eq
    

    Via the API the lines would be separated by & not CR/LF

    In the case of enums you may use an in clause as well.

    status=CUR\TPLN
    status_Mod=in
    

    Note that the values are separated by a tab.