Sandbox-options:--wall-clock-time

Again thank you very very much. This is a lot of new info. I’ll go through everything tomorrow first thing. Thank you for being so helpful and accurate!!! :pray: :pray: :pray: :pray: :pray: :pray: :pray:

Hi Wallace,

I commented the lines but I get an error now saying that “The last statement in a ‘do’ block must be an expression kramer ← allocatePartyWithHint “Kramer” (PartyIdHint “Kramer”)typecheck”. Frome the resources it seems to me that the block “do” needs to have a input to return something, but whatever I tried it didn’t work.

setup = script do
    
    -- jerry <- allocateParty "Jerry"
    -- elaine <- allocateParty "Elaine"
    -- kramer <- allocateParty "Kramer"
    jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry")
    elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine")
    kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer")
    
       {- 
    brandNewCamera <- submit jerry do
        createCmd ItemCustody with
            owner = jerry
            custodian = jerry
            neighbour = kramer
            itemName = "Really Expensive Camera"
            meterCount = 347

    elaineHasCamera <- submit jerry do
        exerciseCmd brandNewCamera ReleaseItemTo with friend = elaine, currentMeterCount = 360

    submit elaine do
        exerciseCmd elaineHasCamera ReturnItemTo with rightfulOwner = jerry, currentMeterCount = 10004 
        -}```

I then tried to add this line after the last line (kramer allocateParty)
create ItemCustody with PartyIdHint = Jerry, PartyIdHint = Elaine, PartyIdHint = Kramer
But, of course, it doesn’t work.

Do you have a bit of spare patience this morning? :pray: :pray: :pray:

Hi, @claudia_giannoni. Sorry… I was away from my computer over the weekend for a US holiday.

Did you get past this error?

The last statement in a ‘do’ block must be an expression
kramer ← allocatePartyWithHint “Kramer” (PartyIdHint “Kramer”)

That error is caused by the fact that Daml scripts are expected to return something. One way to do that is with the return keyword. For example, the last line of a script might be return "OK". Another way to satisfy the requirement that the script return something is for the last line to be an expression. For example, the script originally had this last line:

submit elaine do
        exerciseCmd elaineHasCamera etc.

However, when you commented out the submit statements the last line of the script was no longer the submit elaine do command. Instead the last line of the script was then the following assignment:

kramer ← allocatePartyWithHint “Kramer” (PartyIdHint “Kramer”)

The above assignment is a statement that does not return a value. And, as the error message says it, “The last statement in a ‘do’ block must be an expression”. An assignment does something it does not return something.

In your case, you want your initialization script to just allocate parties. So, instead of the last line of the script being an expression of a command, you can just return ().

setup = script do
    jerry <- allocatePartyWithHint "Jerry" (PartyIdHint "Jerry")
    elaine <- allocatePartyWithHint "Elaine" (PartyIdHint "Elaine")
    kramer <- allocatePartyWithHint "Kramer" (PartyIdHint "Kramer")
    return ()

Hi Wallace!!
Hope you had a great weekend! Thank you a lot for coming back to me.

Sorry I was away too… I went to Italy for a few days :smile:
Thank you ever so much for your reply above. This sorts out everything… IT WORKS!!!

Thank you thank you thank you :pray: :pray: :pray: :pray: :pray: :pray:

1 Like