Query rule substitute

Hi, 

As you know Query Rule has been deprecated in newer versions of Appian. I need a function that will mimic the exact behaviour of Query rule including the return type. 

I have tried using queryEntity() but the return type is not the same as query rule so i am facing a lot of issues. 

Please help! 

TIA 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Keep in mind also that traditional query rules will pass back a "dataSubset" type whenever pagingInfo is passed in.

    Given this, I've previously set up a standard QE recipe which I usually make a new version of for each CDT i might be querying.  In that QE expression rule, I run the query entity as normal (using the passed-in pagingInfo if it was given, and a generic set otherwise); then I return the whole dataSubset if the pagingInfo was provided, and return just the ".data" result from the query entity otherwise.

    Note that this does return basically an "any type" dictionary instead of a type-cast CDT.  I've almost never had an issue with this - it does mean that a very few things need to be manually typecast when these are used.  You could take the subsequent step of typecasting your ".data" output as the CDT type, but this creates its own issues (such as, if the QE returns a selected set of columns instead of all columns).

    What exactly is your use case for needing the exact return type?  What issues is this causing?

  • Hi Mike Schmitt, thanks for your response. 

    I have executed the same QE logic where i am fetching all the columns and using .data 

    I am able to retrive the data and display on the interface. But when I try to SaveInto the column it gives me the following error. Say if the column name is "ABC", then the error is this -

    Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = SM7UJSZM] : An error occurred while executing a save: java.lang.IllegalArgumentException: Invalid index: Cannot index property 'ABC' into type Dictionary

    I have tried to use cast as well giving the type of the datatype but still getting the same error. 

  • 0
    Certified Lead Developer
    in reply to apoorvam
    Cannot index property 'ABC' into type Dictionary

    This is a standard error message when you're trying to access a property that doesn't exist - usually if you have the column name wrong, or if your query has resulted in zero rows.

Reply Children
No Data