Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
8 replies
Subscribers
7 subscribers
Views
2532 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
I have a query entity rule which works in DEV and QA with no issues. However i
rogerp63
Certified Senior Developer
over 8 years ago
I have a query entity rule which works in DEV and QA with no issues. However it fails with "Expression evaluation error at function a!queryEntity [line 2]: An error occurred while retrieving the data." in Production, but ONLY when the batch size is set to anything other than -1. The query is against a secondary datasource which tends to have latency issues at times. Note, there is much higher volume in Production that DEV and QA.
OriginalPostID-191331
OriginalPostID-191331
Discussion posts and replies are publicly visible
Parents
0
rogerp63
Certified Senior Developer
over 8 years ago
Below is the source code. It works when the batchSize is set to -1
a!queryEntity(
entity:cons!LAW_ENT_AP_INVOICE_SUMMARY,
query:a!query(
logicalExpression:{
a!queryLogicalExpression(
operator:"AND",
filters:{
if(ri!approvedQueue_bool,{
a!queryFilter(
field:"OBJ_ID",
operator:"not in",
value:apply(fn!todecimal,split(joinarray(index(rule!LAW_QE_getInvoicePOLine_overspent().data,"API_OBJ_ID",{}),"###"),"###"))
),
a!queryFilter(
field:"PO_RELEASED_FL",
operator:"=",
value:"Y"
),
a!queryFilter(
field:"BALANCED_FL",
operator:"=",
value:"Y"
)},{}),
a!queryFilter(
field:"OBJ_ID",
operator:"in",
value:apply(fn!todecimal,split(joinarray(index(rule!P2P_QE_INV_getInvoiceReview_by_status(statusCde:cons!P2P_STATUS_INV_APPROVED).data,"lawObjId_dec",{}),"###"),"###"))
),
if(isNull(ri!batch_num),{},
a!queryFilter(
field:"BATCH_NUM",
operator:"=",
value: ri!batch_num
)),
if(isNull(ri!isPayBatch_bool),{},
a!queryFilter(
field:"BATCH_NUM",
operator:"not in",
value: {cons!P2P_CFG_INV_BATCH_CA,cons!P2P_CFG_INV_BATCH_US}
)),
if(isNull(ri!operator),{},
a!queryFilter(
field:"OPERATOR",
operator:"includes",
value:ri!operator
)),
if(isNull(ri!vendorName),{},
a!queryFilter(
field:"VENDOR_VNAME",
operator:"includes",
value:ri!vendorName
)),
if(isNull(ri!vendor),{},
a!queryFilter(
field:"VENDOR",
operator:"=",
value:ri!vendor
)),
if(isNull(ri!invoice),{},
a!queryFilter(
field:"INVOICE",
operator:"includes",
value:ri!invoice
)),
if(isNull(ri!voucherNbr),{},
a!queryFilter(
field:"VOUCHER_NUM",
operator:"includes",
value:ri!voucherNbr
)),
if(isNull(ri!ponumber),{},
a!queryFilter(
field:"PO_NUMBER",
operator:"includes",
value:ri!ponumber
)),
if(isNull(ri!handlingCode),{},
a!queryFilter(
field:"HANDLING_CODE",
operator:"=",
value:ri!handlingCode
)),
if(OR(isNull(ri!thruDueDate_dt),isNull(ri!fromDueDate_dt)),{},
a!queryFilter(
field:"DUE_DATE",
operator:"between",
value:{ri!fromDueDate_dt,ri!thruDueDate_dt}
)),
if(AND(not(isNull(ri!thruDueDate_dt)),isNull(ri!fromDueDate_dt)),
a!queryFilter(
field:"DUE_DATE",
operator:"<=",
value:ri!thruDueDate_dt
),{}),
if(AND(isNull(ri!thruDueDate_dt),not(isNull(ri!fromDueDate_dt))),
a!queryFilter(
field:"DUE_DATE",
operator:">=",
value:ri!fromDueDate_dt
),{}),
if(ri!pastDue_bool,
a!queryFilter(
field:"DUE_DATE",
operator:"<",
value:today()
),{})
}
)},
/*pagingInfo:ri!pagingInfo*/
pagingInfo:a!pagingInfo(startIndex:1,batchSize:-1,
sort:a!sortInfo(field:"DUE_DATE",ascending:true)
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
rogerp63
Certified Senior Developer
over 8 years ago
Below is the source code. It works when the batchSize is set to -1
a!queryEntity(
entity:cons!LAW_ENT_AP_INVOICE_SUMMARY,
query:a!query(
logicalExpression:{
a!queryLogicalExpression(
operator:"AND",
filters:{
if(ri!approvedQueue_bool,{
a!queryFilter(
field:"OBJ_ID",
operator:"not in",
value:apply(fn!todecimal,split(joinarray(index(rule!LAW_QE_getInvoicePOLine_overspent().data,"API_OBJ_ID",{}),"###"),"###"))
),
a!queryFilter(
field:"PO_RELEASED_FL",
operator:"=",
value:"Y"
),
a!queryFilter(
field:"BALANCED_FL",
operator:"=",
value:"Y"
)},{}),
a!queryFilter(
field:"OBJ_ID",
operator:"in",
value:apply(fn!todecimal,split(joinarray(index(rule!P2P_QE_INV_getInvoiceReview_by_status(statusCde:cons!P2P_STATUS_INV_APPROVED).data,"lawObjId_dec",{}),"###"),"###"))
),
if(isNull(ri!batch_num),{},
a!queryFilter(
field:"BATCH_NUM",
operator:"=",
value: ri!batch_num
)),
if(isNull(ri!isPayBatch_bool),{},
a!queryFilter(
field:"BATCH_NUM",
operator:"not in",
value: {cons!P2P_CFG_INV_BATCH_CA,cons!P2P_CFG_INV_BATCH_US}
)),
if(isNull(ri!operator),{},
a!queryFilter(
field:"OPERATOR",
operator:"includes",
value:ri!operator
)),
if(isNull(ri!vendorName),{},
a!queryFilter(
field:"VENDOR_VNAME",
operator:"includes",
value:ri!vendorName
)),
if(isNull(ri!vendor),{},
a!queryFilter(
field:"VENDOR",
operator:"=",
value:ri!vendor
)),
if(isNull(ri!invoice),{},
a!queryFilter(
field:"INVOICE",
operator:"includes",
value:ri!invoice
)),
if(isNull(ri!voucherNbr),{},
a!queryFilter(
field:"VOUCHER_NUM",
operator:"includes",
value:ri!voucherNbr
)),
if(isNull(ri!ponumber),{},
a!queryFilter(
field:"PO_NUMBER",
operator:"includes",
value:ri!ponumber
)),
if(isNull(ri!handlingCode),{},
a!queryFilter(
field:"HANDLING_CODE",
operator:"=",
value:ri!handlingCode
)),
if(OR(isNull(ri!thruDueDate_dt),isNull(ri!fromDueDate_dt)),{},
a!queryFilter(
field:"DUE_DATE",
operator:"between",
value:{ri!fromDueDate_dt,ri!thruDueDate_dt}
)),
if(AND(not(isNull(ri!thruDueDate_dt)),isNull(ri!fromDueDate_dt)),
a!queryFilter(
field:"DUE_DATE",
operator:"<=",
value:ri!thruDueDate_dt
),{}),
if(AND(isNull(ri!thruDueDate_dt),not(isNull(ri!fromDueDate_dt))),
a!queryFilter(
field:"DUE_DATE",
operator:">=",
value:ri!fromDueDate_dt
),{}),
if(ri!pastDue_bool,
a!queryFilter(
field:"DUE_DATE",
operator:"<",
value:today()
),{})
}
)},
/*pagingInfo:ri!pagingInfo*/
pagingInfo:a!pagingInfo(startIndex:1,batchSize:-1,
sort:a!sortInfo(field:"DUE_DATE",ascending:true)
)
)
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data