extract string value
Hi, i want to extract the timestamp values and order them low to hight , how can i do, you find here a screenchot of my batabase
thank's
Discussion (5)0
Comments
If you take you time date and convert them to a $H format you can sort them
$ZDTH("09/26/2017 07:35:03")
64552,27303
Why did you post back to this article?
Whoops.
I meant this one.
You can write a function that returns the timestamp of your JSON array, and then SELECT it out like that. Here's an example:
Class Test.JSONProp extends %Persistent
{
Property JSON as %String (MAXLEN=1000);
Property Type as %String;
ClassMethod GetTimestamp(str as %String) as %TimeStamp [SqlProc]
{
try{
s j={}.%FromJSON(str)
s ts=j.Biometrics.%Get(0).TimeStamp
return ts
}
catch err
{
return ""
}
}
}The query then becomes:
SELECT ID,Type,Test.JSONProp_GetTimestamp(JSON) as TS
FROM TEST.JSONProp
ORDER BY TSGive that a try - you'll need to probably do something different with the JSON depending on your version.