QueryEntity Failing when passing 1000 ids on column using IN operator

Certified Senior Developer

Hi All,

I am getting around 2000 ids in one local and then passing that ids to one of column in queryfilter using IN operator. But when i test the rule I get this error as:

An error occurred while retrieving the data. 

So we split the ids in batches by taking 1000 ids in a set and then pass these id to queryfilter through looping. But still it failed with above error.

We have already optimized the view also and same query when we run in DB side it took just 0.170sec to bring the data. But same is not working in Appian queryentity.

Can anyone please suggest what could be the reason behind this and what all steps we can try to get this working. 

Thanks in Advance..

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    in reply to piyusha6151

    Then either recreate the view using records, or implement record level security the old way.

    community.appian.com/.../record-level-security-for-entity-backed-records

  • 0
    Certified Associate Developer
    in reply to Stefan Helzle

    Are you suggesting the following steps-

    1- Instead of using query entity on DB view we should create Record based on that View and use that via query record

    Still we will be passing 1000> ids to this record. Will that have any difference though at the end record will still go to DB to fetch and it is not SYNC enables record( Database related entity is VIEW not Table).

  • 0
    Certified Lead Developer
    in reply to piyusha6151

    I do not understand why you bring up the 1000 IDs again. If you want to implement something similar to record level security, then please follow the guide I linked.

    If this is a misunderstanding, please excuse me. But that pattern you try to implement will not work. The last idea I have is a stored procedure.

  • 0
    Certified Lead Developer
    in reply to piyusha6151

    I am out of my depth, but I think what Stefan is saying, is that you have 2 options:

    • Move fully to RecordTypes, and use RecordType Relationships to re-create the associations you currently have in the VIEW, or
    • Create a stored procedure to implement the functionality.

    That is, with RecordType relationships, or as they are calling it, the "Data Fabric", you don't NEED Views, more often than not.  

    It sounds like you have at least 3 tables you are dealing with.  You constructed a view with at least 2, and then are trying to get the rows from the view, using the Id from the first.  With the "Data Fabric", you could just index into the relationship, of the first, and then index into the relationship field of the next, and so on.

    For Example, if a user has a Personnel File, and that Personnel File points to an officeLocation, and that officeLocation has an officeNumber field, you can get the User's office number like so: 

    User.personnelFile.officeLocation.officeNumber

    Using these relationships, you can populate an interface with data from widely separated tables, using a single a!queryRecordType, and in so doing negate the need for many uses of Views, which I understand (and you note), do not play well with RecordTypes.

    Again, I'm not exactly sure what you are doing, but moving such a large amount of data from the database, through Appian, and then back again, does not seem ideal.