I'm not sure why the request class CSVtoHL7.Inputfile.Record inherits from right. All the request and response are required persistent object. This will be used to display the entire flow in the visual trace section. I have attached some sample below.

You can add a property setter method for property DOB and modify the value from MM/DD/YYYY to +$H value. This will keep the internal date format in database.

Class CSVtoHL7.Inputfile.Record Extends (Ens.Request, %XML.Adaptor, EnsLib.RecordMap.Base) [ ProcedureBlock ]
{
Property ID As %Integer;
Property LastName As %String;
Property FirstName As %String;
Property MiddleName As %String;
Property DOB As %Date;
Method DOBSet(pDate) As %Status
{
    Set i%DOB= $ZDH(pDate)
    Quit $$$OK
}
Property Gender As %String;
ClassMethod createObj() As CSVtoHL7.Inputfile.Record
{
    Set obj = ##class(CSVtoHL7.Inputfile.Record).%New()
    Set obj.DOB="12/30/2001"
    Set obj.FirstName="Test"
    Set obj.ID=12345
    Set obj.MiddleName = "middle"
    Set obj.Gender="M"
    return obj
}
}

Create a object for the request class and send to Transformation. you can use the logic $translate($ZDT(source.DOB_",0",3)," ","T")_"Z" in DTL to convert the internal date format to required output 2023-08-24T00:00:00Z. You can refer the DTL sample below

Class CSVtoHL7.DTL.Record Extends Ens.DataTransformDTL [ DependsOn = (CSVtoHL7.Inputfile.Record, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='CSVtoHL7.Inputfile.Record' targetClass='EnsLib.HL7.Message' targetDocType='2.5:ADT_A01' create='new' language='objectscript' >
<assign value='source.ID' property='target.{PID:SetIDPID}' action='set' />
<assign value='source.FirstName' property='target.{PID:PatientName().FamilyName}' action='set' />
<assign value='source.MiddleName' property='target.{PID:PatientName().GivenName}' action='set' />
<assign value='source.Gender' property='target.{PID:AdministrativeSex}' action='set' />
<assign value='$translate($ZDT(source.DOB_",0",3)," ","T")_"Z"' property='target.{PID:DateTimeofBirth.Time}' action='set' />
</transform>
}

}

output

As we mentioned above the DOB should have +$H value instead of MM/DD/YYYY. However you can try the below

If DOB is date format

IRISMYDEV>set dob="12/01/1993"
IRISMYDEV>write $translate($ZDT($ZDTH(dob),3)," ","T")_"Z"
1993-12-01T00:00:00Z

If DOB is +$H value

IRISMYDEV>set dob=+$H
IRISMYDEV>write $translate($ZDT(d_",00000",3)," ","T")_"Z"
2023-08-24T00:00:00Z

Hello Smythe,

I agree with @Robert Cemper points. The %Date datatype is for +$H which means numeric date value. Not an string. You should modify the datatype of the property or use string functions.

IRISMYDEV>s obj = ##Class(CSVtoHL7.Inputfile.Record).%New()
IRISMYDEV>s obj.DOB="12/12/1993"
IRISMYDEV>zw ##Class(%Date).IsValid(obj.DOB)
"0 "_$lb($lb(7207,"12/12/1993",,,,,,,,$lb(,"IRISMYDEV",$lb("e^IsValid+1^%Library.Date.1^1","e^^^0"))))/* ERROR #7207: Datatype value '12/12/1993' is not a valid number */
 
IRISMYDEV>w $SYSTEM.OBJ.DisplayError()
ERROR #7207: Datatype value '12/12/1993' is not a valid number1
IRISMYDEV>s obj = ##Class(CSVtoHL7.Inputfile.Record).%New()
IRISMYDEV>s obj.DOB=$ZDateH("12/12/1993")
IRISMYDEV>zw ##Class(%Date).IsValid(obj.DOB)
1

Hello Pierre,

You have two options to get query parameters

  1. You can merge the entire %request.Data into local array and use string function.
  2. User %request.Next(data) method to loop the %request.Data one by one and get query parameter values

ClassMethod GetQueryParams()
{
	set data=""
	For {
		set data  = %request.Next(data) quit:data=""
		write data,!
	}
}
OUTPUT
Bottom
Name
Top

For cgiEnvs. You can follow same merge option to get all values. Otherwise use  %request.NextCgiEnv(cgi) to get the list of available values.

ClassMethod GetcgiEnvs()
{
    set cgi=""
    for {
        set cgi  = %request.NextCgiEnv(cgi) quit:cgi=""
        write cgi,!
    }
}

If you're receiving unexpected fields(key value pairs) as part of the JSON and the properties are not included in the class definition. You need to add the below parameter in your class definition(%JSON.Adaptor extended class). This will ignore loading the unexpected field.

Parameter %JSONIGNOREINVALIDFIELD As BOOLEAN = 1

In addition, The JSON key-value pair data type should match with class definition property datatype.