Daml test scrip usage
- brijg11OP
HI
I am trying to filter out contracts usingqueryFilterinside a test scriptlet cancelPredicate = (\swiftOutboundMsg -> case swiftOutboundMsg.swiftMessage of MT548 mt548 -> mt548.status == CAND other -> False) swiftTradeConfirmationMsgs <- queryFilter @SwiftOutboundMessage settlementAgent (\t -> (t.swiftMessageType == MT548_buy_t) && (cancelPredicate))The above code executes with the following error:
h:/work/dtip/src/test/daml/Tests/Syndicate/SwiftReporting.daml:98:130: error: • Couldn't match expected type ‘Bool’ with actual type ‘r0 -> Bool’ • Probable cause: ‘cancelPredicate’ is applied to too few argumentsIs there a better way to achieve this?
- cocreature
cancelPredicateis a function that you need to apply to the swift message. Try something likeswiftTradeConfirmationMsgs <- queryFilter @SwiftOutboundMessage settlementAgent (\t -> (t.swiftMessageType == MT548_buy_t) && (cancelPredicate t)) - brijg11 1
Thanks. this is cool