Namespace: API

API

general, mobile API Functions

Methods

<static> getDateObject(oHtml) → {date}

Creates an JavaScript date object from a html control.

Parameters:
Name Type Description
oHtml object

Reference to a html input control of types "date", "time" or "date & time".

Returns:

JavaScript date object

Type
date
Example
getDateObject(getElement("A84E5E7F9EA9ED1A829DB98DBF5459F59961FA3B"));

<static> getLocalDurationString(oHtmlDateFrom, oHtmlDateTo) → {string}

Calculates the difference of values from two html controls of type "date & time" and returns it as string formatted as "2 days 3 minutes"

Parameters:
Name Type Description
oHtmlDateFrom object

Reference to a html control of type "date & time"

oHtmlDateTo object

Reference to a html control of type "date & time"

Returns:

string formatted as "2 days 3 minutes".

Type
string
Example
getLocalDurationString(getElement("4E48F310711C446B4B04752A6B3239900D49F3A0"),getElement("E13A41C114E8754574DEA9767F505DDE3491C89A"));

<static> getLocalDurationString(p_oDate) → {number}

Compares a value of a date control with the current date. Imperative for input and view controls (for view controls the expert attribute jsobject = true (Boolean) has to be set.)

Parameters:
Name Type Description
p_oDate

Reference to an html input control of type "date", "time" or "datetime"

Returns:

JavaScript number object.

Type
number
Example
dateComparedToNow(getElement("5F7S5E7F9EA9ED1A829DB98DBF5459F59961FA3B"));

<static> getLocalDurationString(interval, number, date) → {date}

Adds or subtracts a interval to/from a given JavaScript date object.

Parameters:
Name Type Description
interval string

Possible values: "ms" - for milliseconds; "s" - for seconds; "mi" - for minutes; "h" - for hours; "d" - for days; "mo" - for months; "y" - for years;

number integer

value for given interval, that should be added to date. Negative values are also possible.

date date

JavaScript date object.

Returns:

JavaScript date object.

Type
date
Example
var dtNow = new Date();
        var dtAdd1 = dateAdd("d", 1,  dtNow); // adds 1 day to current date.
        var dtAdd2 = dateAdd("h", -2, dtNow); // subtracts 2 hours from current date.

<static> getLocalDurationString(eventGuid, urlParameters, ajaxParameters)

Triggers an User Workflow Event.

Parameters:
Name Type Description
eventGuid string

The paramter "eventGuid" of the generic event handler.

urlParameters object

Map containing name value pairs, which will be part of the querystring.

ajaxParameters object

Map containing synchronous mode and type mode

Example
// Example 1
        // Trigger event with guid <GUID>. Define a generic event handler with the class "de.uplanet.lucy.server.workflow.eventhandler.UserWorkflowEventHandler" before.
        triggerUserWorkflowEvent("<GUID>", {"param1":"value1","param2":"value2"}, {"async": [true/false], "type":"value" });

        // Example 2
        $.when(triggerUserWorkflowEvent("<GUID>", {"param1":"value1","param2":"value2"}, {"async": [true/false], "type":"value" }))
        .done(function() {
            alert("done")
         })
        .fail(function() {
            alert("failed :(")
         });

<static> toLocalString(oHtml, strValue) → {string}

Creates a local formatted string from an number string or a datetime string.

Parameters:
Name Type Description
oHtml object

Reference to a html input control of types "integer", "double", "currency" (format settings can be appended here, too).

strValue string

Number string or date string.

Returns:

Local formatted number as string or local formatted datetime as string

Type
string
Example
toLocalString(getElement("DDB279D4974A17DB27A89F58DB36F7BF4E10DA13"),"123.45");

<static> writeLocalString(oHtml, strValue) → {boolean}

Creates a local formatted string from an number string or a datetime string and writes it as value into a html control.

Parameters:
Name Type Description
oHtml object

Reference to a html input control of types "date", "time", "date & time", "integer", "double", "currency" (format settings can be appended here, too).

strValue string

Value to localize.

Returns:
Type
boolean
Example
writeLocalString(getElement("DDB279D4974A17DB27A89F58DB36F7BF4E10DA13"),"123.45");