我有 2 个关于 DAML 自动选择和场景的可能性的问题。我有这个模板需要输入 a ContractId
:
template Create_Creation
with
current_login : Party
artist : Party
title : Text
votingRight : Set Party
observers_list_id : ContractId Observers
where
signatory current_login
我需要在场景中创建其中一些模板,但无法指定 ContractId(如 #0:0),这给了我以下错误:Couldn't match expected type 'ContractId Observers' with actual type 'Text'
是否可以在场景中指定 ContractId?
接下来,在上面的模板中,我有一个choice
定义的调用Load_all_creation_observers
,它创建一个模板 Creation 并将指定的观察者加载template Observers
到其中作为观察者:
choice Load_all_creation_observers : ContractId Creation
controller current_login
do
observers_list <- fetch observers_list_id
create Creation with created_by = current_login; artist = artist; title = title;
votingRight = votingRight; observers_list_id = observers_list_id; observers = observers_list.observers
template Observers
with
superuser : Party
observers : Set Party
where
signatory superuser
observer observers
就目前的代码而言,当用户创建一个模板时,Create_Creation template
他需要执行Load_all_creation_observers
选择以创建Creation
模板,并将所有观察者加载到模板中。Create_Creation
当用户提交模板时,是否可以自动执行此选择?或者可能根本不选择它并将其定义为自动化功能,就像您在普通编程语言(if 语句)中所做的那样。您似乎只能do
在选择中定义功能。