I have a process model that includes a script task with the following output:
rule!SC_getImportPregressoPc(id: pv!index)
The problem I'm facing is that I'm incrementing the index by 1 in each iteration to move to the next item, but the IDs in my dataset are not sequential. For example, I have IDs like 5, 6, 7, but the next ID might be 500 due to filtering applied by the rule, causing my process to exit early when it reaches a gap in the ID sequence.
How can I configure the process to iterate over only the IDs present in my filtered list, rather than assuming a simple +1 progression?
Any guidance would be appreciated!
Discussion posts and replies are publicly visible
What is SC_getImportPregressoPc() doing?
If it's querying, why wouldn't the "pv!index" you're feeding in just iterate the StartIndex of the PagingInfo? This would completely bypass the issue of gaps in an ID sequence, and even different sortings (if you want to prioritize items by implementing custom sorts, etc).
this is what my SC_getImportPregressoPc() returns only one value using id filter:
index(a!queryRecordType( recordType: 'recordType!{}SC Import Pregresso PC', fields: {}, filters: a!queryLogicalExpression( operator: "AND", filters: { a!queryFilter( field: 'recordType!{}SC Import Pregresso PC.fields.{}scarto', operator: "=", value: false ), a!queryFilter( field: 'recordType!{}SC Import Pregresso PC.fields.{}id', operator: "=", value: ri!id ) }, ignoreFiltersWithEmptyValues: true ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 100 ) ).data,1,null)
I understand your explanation, but I'm still not sure how this approach helps me iterate through the next item in the list without using id. Could you please provide a more detailed example or breakdown to make this clearer? Thank you!
What Mike Schmitt is referring to, is using the paging info to fetch one item after the other.
https://docs.appian.com/suite/help/25.1/fnc_system_a_paginginfo.html
When you set the batchSize = 1, and increment the startIndex on each cycle, you do not have to care anymore about the primary key values.