2 Replies Latest reply on Apr 29, 2020 8:17 AM by Judy Andrews

    Query Formatting in Get Entry By Query - DWP Catalog

    Judy Andrews
      Share This:

      Does anyone have any examples of a more complex query with variables in the Get Entry By Query for DWP Catalog?  Most examples I see are a single query, but I need to write a bit more complex with multiple ANDs.  I'm not getting errors on my query and it works fine when I hard code values, but once I introduce a variable it seems to not return a record, so I think I have the formatting slightly wrong within the context of the variable.

       

      Works (no variables)

      "'AssetInstanceId' = ""OI-E5E2FE3C76F7474BA79C867B099D40DE"" AND 'Request_Type' = ""Support Group"" AND 'Status' = ""New"" AND 'PersonRole'= ""Approved by"""

       

      Doesn't Work

      "'AssetInstanceId' = "" + ${processContext.local_ReconID} + "" AND 'Request_Type'=""Support Group"" AND 'Status' = ""New"" AND 'PersonRole'= ""Approved by"""

        • 1. Re: Query Formatting in Get Entry By Query - DWP Catalog
          Hugo Stadin

          Hi Judy,

           

          It can be a bit confusing but I will try to give you a few examples.

           

          Before using variables in a query you have to close the quotation marks, for example.

           

          I haven't tested this exact query but it should work:

          "'AssetInstanceId' = """ + ${processContext.local_ReconID} + """ AND 'Request_Type'=""Support Group"" AND 'Status' = ""New"" AND 'PersonRole'= ""Approved by"""

           

          BR,

          Hugo

          • 2. Re: Query Formatting in Get Entry By Query - DWP Catalog
            Judy Andrews

            Thanks, Hugo.  That at least got me pointed in the right direction.  The quotations were definitely part of my problem, but I also found that my variable wasn't being passed correctly from my output because I included quotations in the output where I shouldn't have.  Some places you need them, some places you don't.  Not intuitive at all.  It'd be great if they could provide some examples within the GUI itself because the documentation is so limited on suggested formatting.  Here was my final query that worked successfully in case anyone else needs to do something similar:

             

            (("'Status' = ""New"" AND 'PersonRole'=""Approved by"" AND 'Request_Type'=""Support Group"" AND 'AssetInstanceId'=""" + local_ReconID) + """")