Using dates in Cache: (an alternative to this)
- Class Person…. { DOB As %Date }
- INSERT INTO Person(… DOB) VALUES(…, TO_DATE('12 Jan 1989')
Using queries in Cache:
Class HIS.Patient Extends %Persistent
{
Property Name As %String;
Property DOB As %Date;
Property Inpatient As %Boolean;
/// Class query
Query GetInpatients(Inpatient As %Boolean=1) As %SQLQuery(SELECTMODE="RUNTIME")
{
SELECT * FROM Patient
WHERE Inpatient = :Inpatient
ORDER BY Name
}
}
Insert some data in SQL, then:
- S rset=##class(%RecordSet).%New()
- S rset.ClassName="HIS.Patient"
- S rset.QueryName="GetInpatients"
- Do rset.Execute(1)
- W rset.Next()
- If result is 1, w rset.Data("Name")