Converts a dtl
value to a string.
Remarks
The formatdtl() function is limited to client-side queries, which means that it does not work
with arguments that are the direct results of a server-side query. When you need to display a
date that you query from a reference table on the server as a string, stringify the
dtl
in the control that will display it, and not in the query itself.
The sample below has two dropdown
controls that query the same columns of
the nufDtl
reference table in the Cloud. One runs formatdtl() on the
dtl
returned by the query in the textMap
property. The
other one would throw an error at compile-time because it attempts to run formatdtl() as part
of the query itself.
To be able to run the server-side query to a reference table in the example below, you'll need the declaration file and some input data for the reference table that the code sample queries.
... <dropdown id="ddFoo" label="When was Charlie Chaplin born?" choices='{SELECT p.numint, p.dtl FROM nufDtl p}' keyMap='{numint}' textMap='{FORMATDTL(dtl, (dtf d "/" M "/" yy " " H ":" m ":" s))}'/> <!--This would throw an error at compile time because the query attempts to run a client-side function on a server-side reference table query <dropdown id="ddBar" label="When was Wounded Knee?" choices='{SELECT g.numint, (FORMATDTL(g.dtl, (dtf d"/"M"/"yy" "H":"m":"s))) b FROM nufDtl g}' keyMap='{numint}' textMap='{TOSTRING(dtl)}'/>-->
Sample
... <datepicker id="dateDate" label="Pick a date" dateFormat='(dtf yyyy"-"MM"-"dd)' invalidDateMessage="That's not a date."/> <textview label="Your date in big-endian order" text='{FORMATDTL(dateDate.date, (dtf yyyy"/"MM"/"dd))
}'/> <textview label="Your date in little-endian order" text='{FORMATDTL(dateDate.date, (dtf dd"."MM"."yyyy))
}'/> <textview label="Your date in middle-endian order" text='{FORMATDTL(dateDate.date, (dtf MM" "dd" "yyyy))
}'/> ...
Figure 300. Depending on the dateFormat
you pass it, formatDtl()
will parse the same dtl
into any number of strings