How To Format Non-Text Types In Let Statement Using Daml.Script
- quidagisOP 1
@SteveSeow gave me some good advice this morning about the use of Scripts to test Templates (I have not been doing it), and showed me how to use a
Letstatement block with Types parsed in from one of the custom Record Types

I have had good success so far, until the following Types.
With a
Letblock statement of:let patientX = PatientSummary with consultingRooms = "Yes", patientName = "Michael", patientCode = "10001", patientGender = "Male", dateOfConsult = "2021-09-26", consultNotes = "Michael is not well"Relevant Record Type:
data PatientSummary = PatientSummary -- Patient extract Medical CMS with consultingRooms : Bool <- Fail patientName : Text <- OK patientCode : Int <- Fail patientGender : Text <- OK dateOfConsult : Date <- Fail consultNotes : Text deriving (Eq, Show)However if all Types are designated as
Text, the Script will run.consultingRooms : Text patientName : Text patientCode : Text patientGender : Text dateOfConsult : Text consultNotes : TextIs there a solution to this, or for the sake of a Write-Once, Execute-Many Script, is this a non-issue?
- dtanabe 2
The reference for Daml types can be found here: Reference: data types — Daml SDK 1.17.1 documentation
Generally, only strings should have double quotes, so in your example:
import DA.Date -- required for using the date function below let patientX = PatientSummary with consultingRooms = True, patientName = "Michael", patientCode = 10001, patientGender = "Male", dateOfConsult = date 2021 Sep 26, consultNotes = "Michael is not well" - quidagis 2
Thank you for that, it fixed the formatting and errors immediately.
I just realised that I had not seen
import DA.Date, fixed