/* I've replaced the hard-coded date with 'today()' so I can capture updates to the first * data entity first and use the resulting 'ids' to query the second table for updates. * As I suspected, I get an error if the first query results in an 'empty set' * I get "Expression evaluation error: Invalid index: Cannot index property "id" of type Text into type List of Variant" * I've tried several if() statements to check for null values but I keep getting the same error. Ugh! with( local!checkIds: fn!index(a!queryEntity( entity: cons!ABC_CHECK_DS, query: a!query( selection: {}, logicalExpression: a!queryLogicalExpression( operator: "OR", filters: { a!queryFilter( field: "effectiveDateTime", operator: ">=", value: todatetime(today()) ) } ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1, sort: a!sortInfo( field: "id", ascending: true ) ) ) ).data,"id",null), local!entities: a!queryEntity( entity: cons!ABC_AMOUNT_DS, query: a!query( filter: if( rule!APN_isEmpty(local!checkIds), null, a!queryFilter( field:"checkid", operator:"in", value: tointeger(local!voidedcheckIds) ) ) ), pagingInfo: a!pagingInfo( startIndex: 1, batchSize: -1 ) ) ).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) ) )