Skip to content
CCPEDIAby Unity Nodes
Outreach

The new REPL feature of displaying the JSON representation of DAML values starting with 1.5.0 RC is really cool

1 posts489 views7 likesLast activity Sep 2020

  1. gyorgybalazsiOP 7

    This is how I defined a medical fitness input submission value in one of my DAML models which implements a driving license issuing process:

    d1 = date 2020 Apr 28
    t1 = time d1 12 0 0
    odt1 = OrderingDateTime d1 t1
    exptime1 = time (addYearsToDate 10 d1) 23 59 59
    exptime2 = time (addYearsToDate 3 d1) 23 59 59
    
    mfis : Input
    mfis = MedicalFitnessInput $ MedicalFitnessInputSubmission with 
                                  fitness = (Fit with expiry = exptime1)
                                  orderingDateTime = odt1
    

    This is how I can display its DAML value and JSOM representation in REPL:

    daml> mfis
    MedicalFitnessInput (MedicalFitnessInputSubmission {fitness = Fit {expiry = 2030-04-28T23:59:59Z}, orderingDateTime = OrderingDateTime {officialDate = 2020-04-28, arrivalTime = 2020-04-28T12:00:00Z}})
    daml> :json mfis
    {"tag":"MedicalFitnessInput","value":{"tag":"MedicalFitnessInputSubmission","value":{"fitness":{"tag":"Fit","value":{"expiry":"2030-04-28T23:59:59Z"}},"orderingDateTime":{"officialDate":"2020-04-28","arrivalTime":"2020-04-28T12:00:00Z"}}}}
    daml>