Mendix Client 4 API Documentation


mxui.sys.DataParser

Methods

parseDate(dateString, opts)

Converts a string in the given format to a date (see dojo.date.locale.format).

Parameters

Name Type Description
dateString String The string to parse
opts.selector String What part of the date to parse. Either “time” or “date”. “Date” is the default.
opts.format String How to format the date. One of “long”, “short”, “medium” or “full”. “Short” is the default.
opts.datePattern String The date pattern to use.
opts.timePattern String The time pattern to use.

Returns

Type Description
Number The parsed date in milliseconds since the epoch

formatDate(epoch, opts)

Converts a date in the given format to a string (see dojo.date.locale.format).

Parameters

Name Type Description
epoch Number The date in milliseconds since the epoch.
opts.selector String What part of the date to convert. Either “time” or “date”. “Date” is the default.
opts.format String How to format the date. One of “long”, “short”, “medium” or “full”. “Short” is the default.
opts.datePattern String The date pattern to use.
opts.timePattern String The time pattern to use.

Returns

Type Description
String The formatted date

parseNumber(value, unused, precision)

Converts a string in the given format to a number.

Parameters

Name Type Description
value String The string to parse
unused Unused
precision Number The precision to which to round the returned number.

formatNumber(value, groups, precision)

Converts a number to a string in the requested format.

Parameters

Name Type Description
value Number The value to convert.
groups Boolean Whether to use a group seperator in the output
precision Number The number of decimal places in the output

Returns

Type Description
String The formatted value

replaceXPathTokens(xpathString, mxcontext)

Expand XPath tokens in a string.

Parameters

Name Type Description
xpathString String The string in which to expand the tokens.
mxcontext MxContext Context used for the expansion.

Expansions

Token Description
%CurrentDateTime% The current date and time.
%CurrentObject The current object from the given context.

Returns

Type Description
String Expanded string

startup(callback)

This method is called to startup the subsystem.

Parameters

Name Type Description
callback Function The function to be called when startup is finished.

shutdown()

This method is called to shutdown the subsystem.

isLoaded()

This method is called to check whether the subsystem has been started.