Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Can we put do blocks directly in templates?Forum ↗

Can we put do blocks directly in templates?

App Development5 posts253 views2 likesLast activity Jun 2021
HE
Hem-MOP
Jun 2021

A question related to this ( i guess )

Can we write “do” block in template ( or not under any choice ) ? if yes, can you share a sample snippet doing same?

in my case

template A
with
partyA : Party
where
signatory partyA
do ( gives error as : parse error on input ‘do’ )

AN
anthony
Jun 2021

Good question, do blocks are Actions which are impure so they can’t be used directly in templates (you’d typically use them in Updates in Choices or in Scripts).

What’s the intended use case for wanting do in the template itself?

HE
Hem-M
Jun 2021

Exploring DAML.

What’s the intended use case for wanting do in the template itself?

When a “ContractB” gets created ( using template ) it must eventually pull multiple contract of type “ContractA” and then get dataset(thought of using “do” here) from each “ContractA” to proceed with next action/choice.

CO
cocreature
Jun 2021

Can you instead fetch those contracts in a choice?

HE
Hem-M
Jun 2021

yes… but isn’t that a multiple/extra action? first call contract and then exercise choice

← Back to Discussions