We have used Length many times in Routing rules to check to see if Admit/Discharge date exists. We haven't quite used HL7.{PV1:45} to get the field, we let the system spell it out for us... so instead of HL7.{PV1:45} we allow the system to put it in the nomenclature that it knows the field as.. in this case HL7.{PV1:AdmitDateTime.Time}

setting the following did not work  InitialExpression = {$zdt($zu(188),3,1)} as the records are being read by EnsLib.RecordMap.Service.FileService into the record map generated table, I can not get the DateInserted column to auto-populate.

Does anyone have any suggestions on getting this DateInserted column to populate as the RecordMap.Service is reading in the file?

Thanks

Scott

I think I figured it out, but could someone verify?

I am able to edit the class file in Studio to enable "DDLAllowed".

1. Then I scripted the following...

Alter table "osuwmc_Workday_DataStructures_FSINT3376ItemMaster"."Record" ADD DateInserted DateTime 

2. After I was able to add the time through SQL I was able to alter the column to set the DEFAULT = getdate()

Alter table osuwmc_Workday_DataStructures_FSINT3376ItemMaster.Record Alter DateInserted DEFAULT(getdate())

In the class file it is now showing...

Property DateInserted As %Library.TimeStamp [ InitialExpression = {$zdt($zu(188),3,1)}, SqlColumnNumber = 24 ];

I realize I can probably combine my SQL statements, but I did not use the Generator.GenerateObject(). Is this ok?

Thanks

Scott

I maybe wrong... But since the native format of dates in Ensemble are not strings, unless you create a function to convert $HOROLOG into a string and set it equal to the variable of Today, I do not think this is possible. 

http://intengtest:57772/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_vhorolog

/// Provide the current date HL7 Format YYYYMMDD
ClassMethod getCurrentDateHL7() As %Numeric
{
quit $ZDATE($H,8)
}
 

/// Compare a Message Date/Time with the CurrentDate
ClassMethod DateCompare(DateString As %String) As %Boolean [ Final ]
{
Set CurDate=$PIECE($HOROLOG,",",1)
Set MyDate=$EXTRACT(DateString,1,8)
Set TestDate=$ZDATEH(MyDate,8) //Calculation example: 20150304 - 20150306 = -2, function returns '0'
If (TestDate - CurDate < 0)
{
quit 0
}
Else
{
quit 1
}
}