ExerciseByKey wildcard
App Development2 posts177 views1 likesLast activity Aug 2023
MA
Marc54OP
Aug 2023New to DAML here.
Looking to implement an update on a group of contracts of another type given a key pattern. can owner update all contracts that have key of owner and wildcard field. Is this possible? Are wildcard pattens supported?
exerciseByKey @B (owner, <wildcard>) do_something with ....
Current Design is as follows:
Template A
with
owner: Party
...
where
signatory owner
choice Update : ContractId A with
controller owner
exerciseByKey @B (owner, <wildcard>) do_something with ....
create this with ...
choice Create B: ContractId B with
...
controller owner
create B with otherPerson
Template B
with
owner: Party
otherPerson: Party
where
signatory owner
observer otherPerson
key (owner, otherPerson) : (Party, Party)
maintainer key._1
choice do_something: ContractId B with ....
CO
cocreature
Aug 2023No, you need to specify the full key. If you need wildcard like behavior you need to resolve the query off-ledger, e.g., have your client track all contracts and build an index to answer those wildcard queries and then pass in the actual contract id you want to exercise on to the ledger