Solved
I would like to loop for querying two tables with id
a!localVariables(
local!priceId: http!request.queryParameters.pgenId,
local!docId: http!request.queryParameters.docId,
local!entities: a!forEach(
items: local!pgenId,
expression: a!queryEntity(
entity: cons!DS_ENTITY1,
query: a!query(
logicalExpression: {
a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "priceid",
operator: "=",
value: local!priceId
),
}
)
},
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 50)
),
fetchTotalCount: true
).data,
a!queryEntity(
entity: cons!DS_Entity2,
query: a!query(
logicalExpression: {
a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(
field: "docId",
operator: "=",
value: local!docId
),
}
)
},
pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 50)
),
fetchTotalCount: true
).data,
),
/*
* Construct an HTTP response that contains the information that we just stored
* in "local!entities".
*/
a!httpResponse(
/*
* Set an HTTP header that tells the client that the body of the response
* will be JSON-encoded.
*/
headers: {
a!httpHeader(
name: "Content-Type",
value: "application/json"
)
},
/*
* JSON-encode the value of "local!entities" and place it in the response body.
*/
body: a!toJson(value: local!entities)
)
)
