Skip to main content
Known Participant
Sep 27, 2023 10:58 PM UTC
Question

Batching the query example with looping

Can someone help with example. How to do batching in Query.

I have clear understanding of how it works but need clarity while implementing.

 Eg: create a query entity rule such as : a!queryEntity(entity: cons!entity, query: a!query(filters{whatever filters you want},
local!pagingInfo(startIndex: 1, batchSize: 100)
))

after this what i need to do?

I need to fetch 7000 records

    3 replies

    mathieud0001
    Genius
    Sep 27, 2023 11:21 PM UTC

    https://docs.appian.com/suite/help/23.3/configure-record-data-source.html#syncing-in-batches 

    a!localVariables(
      local!batchSize: 100,
      local!startIndex: 1 + ((ri!batchNumber - 1) * local!batchSize),
      a!queryRecordType(
        recordType: 'recordType!{SYSTEM_RECORD_TYPE_USER}User',
        pagingInfo: a!pagingInfo(local!startIndex, local!batchSize)
      )
    )

    stefanhelzle0001
    Brainy
    Sep 28, 2023 6:49 AM UTC

    For what purpose do you want to load 7000 records into memory? In general, this is a bad practice and not recommended!

    itsm6335Author
    Known Participant
    Sep 29, 2023 8:05 AM UTC

    I totally agree with your point [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] but when you are working on already built Application which is live, we cannot go ahead and follow all the best practice and latest features all of a sudden, we need to first make changes to existing code and make the Application work as expected. 

    So if you have solution to my question that will help me.