Skip to main content
manavik105
July 4, 2025
Question

How to query first row from a datasubset

  • July 4, 2025
  • 3 replies
  • 0 views

Hi All,

I have my expression rule as below and I'm trying to get 100 records in 1 batch to pass to the process model. Now I need to fetch the 1st row from this rule output into a process model - perform some action and then loop back to fetch the second row - perform some action, loop back third record to fetch 3rd row and so on until I reach my 100th record. Please advise what expression do I need to write here to fetch the rows and loop back?

Rule:

a!localVariables(
local!getData: a!queryEntity_22r2(
entity: cons!SAC_ENTITY_CLIENTCASES,
fetchTotalCount: true,
query: a!query(
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {

),
a!queryFilter(
field: "docsSent",
operator: "is null"
)
}
),
selection: a!querySelection(
columns: {
a!queryColumn(field: "caseId"),
a!queryColumn(field: "caseStatus"),
a!queryColumn(field: "clientName"),
a!queryColumn(field: "folderId")
}
),
pagingInfo: if(
rule!APN_isBlank(
ri!pagingInfo
),
a!pagingInfo(
startIndex: 1,
batchSize: 5,
sort: a!sortInfo(
field: "caseId",
ascending: true
)
),
ri!pagingInfo
),
)

),
local!getData
)

Output of the Rule saved into PV of type data subset in process model:

  • startIndex1(Number (Integer))
      • batchSize10(Number (Integer))
          • sortList of SortInfo - 1 item
              • SortInfo
                  • field"caseId"(Text)
                      • ascendingtrue(Boolean)
                      • totalCount5(Number (Integer))
                          • dataList of Dictionary - 5 items
                              • Dictionary
                                  • caseId322(Number (Integer))
                                      • caseStatus"On-Hold/Request for Info"(Text)
                                            • clientName"user1520872"(Text)
                                                • folderId214625(Number (Integer))
                                                  • Dictionary
                                                      • caseId21326(Number (Integer))
                                                          • caseStatus"On-Hold/Request for Info"(Text)
                                                                • clientName"user1520872"(Text)
                                                                    • folderId154459(Number (Integer))
                                                                      • Dictionary
                                                                          • caseId21327(Number (Integer))
                                                                              • caseStatus"Ready For Underwriting"(Text)
                                                                                    • clientName"user1520872"(Text)
                                                                                        • folderId154458(Number (Integer))
                                                                                          • Dictionary
                                                                                              • caseId52046(Number (Integer))
                                                                                                  • caseStatus"Ready For Underwriting"(Text)
                                                                                                        • clientName"user1520872"(Text)
                                                                                                            • folderId154458(Number (Integer))
                                                                                                              • Dictionary
                                                                                                                  • caseId59106(Number (Integer))
                                                                                                                      • caseStatus"On-Hold/Request for Info"(Text)
                                                                                                                            • clientName"user1520872"(Text)
                                                                                                                                • folderId154459(Number (Integer))
                                                                                                                                • identifiersList of Number (Integer) - 5 items
                                                                                                                                    • 322(Number (Integer))
                                                                                                                                        • 21326(Number (Integer))
                                                                                                                                            • 21327(Number (Integer))
                                                                                                                                                • 52046(Number (Integer))
                                                                                                                                                    • 59106(Number (Integer))

                                                                                                                                                  3 replies

                                                                                                                                                  harshas2775
                                                                                                                                                  July 5, 2025

                                                                                                                                                  What action you want to perform on the datasubset rows individually?

                                                                                                                                                  can they be done in an expression instead of process model? 

                                                                                                                                                  amaans4178
                                                                                                                                                  July 5, 2025

                                                                                                                                                  Hi, you can fetch all the rows in the process model and use MNI (Multiple Node Instances) on the desired node or subprocess to process each row individually. Alternatively, you can loop through the rows using process variables like currentIndex combined with conditional gateways.

                                                                                                                                                  If you want your rule to return only one row at a time, you’ll need to pass an input (e.g., currentIndex) to the rule, which determines the current iteration and fetches the corresponding item based on that index via index() or property function.

                                                                                                                                                  konduruc733182
                                                                                                                                                  July 6, 2025

                                                                                                                                                  Hello [mention:07380a99cd9a4931a32956f0ec3a7923:e9ed411860ed4f2ba0265705b8793d05] 

                                                                                                                                                  I would recommend fetching the data once and configure a MNI where you are using this data and save the instance index in a process variable and use this value to index the data that has already been fetched.