Skip to content

Freemarker API Reference

Welcome to the FreeMarker API Reference, part of the RunMyProcess backend scripting API. This section documents the FreeMarker-based functions available within RunMyProcess.

FreeMarker is a templating language historically used within RunMyProcess for server-side scripting and simple variable logic. It remains supported for straightforward use cases such as text templating and basic workflow automation. However, FreeMarker is limited in scope compared to full programming languages and does not provide the richer control structures and libraries available in more modern environments. RunMyProcess.

For more powerful and flexible scripting, we recommend using the RunMyScript backend with JavaScript (ES6) or Python, both of which offer a feature-equivalent set of custom RMP functions and a broader programming model. These options simplify complex logic, improve maintainability, and align with current development best practices. RunMyProcess.

Use this reference to understand the available FreeMarker functions for application management, and consider migrating scripts to JavaScript ES6 or Python where appropriate to take advantage of the enhanced capabilities they provide.

Freemarker Reference Guide (External - by Apache)

  • Freemarker Reference
  • Application

    Functions to manipulate an application.

    attach_file

    Attach a file or a list of files to an application. This function only works when computed in 'Input variables' of a manual task.

    Returns: array - Descriptors of the attached files.

    Param Type Description
    file_variable array / string The variable of an uploaded file widget, containing one file identifier or a list of file identifiers.
    file_widget_id string (optional) Identifier of the uploaded file widget to which the file(s) should be attached. Necessary if several uploaded file widgets are present in the application.

    detach_file

    Detach a file or a list of files from an application.

    Returns: array - Descriptors of the detached files.

    Param Type Description
    file_variable array / string One file identifier or a list of file identifiers in a JSONArray format or the variable of an uploaded file widget.
    instance_id string Application instance from which the file(s) shall be detached.

    get_history

    Get the history of modifications of application instances during a process, just as the history widget would do it.

    Returns: array - Array of history metadata.

    get_instance_info

    Get the metadata describing an application instance.

    Returns: applimetadata - Application instance description.

    Param Type Description
    instance_id string Identifier of the application instance.

    i18n

    Internationalization method. Get the translation of a key in a given language for email activities.

    Returns: string - Target translation or defaultValue if nothing found.

    Param Type Description
    key string -
    defaultValue string Default value if key is not found in language.

    list_attached_file

    List the files attached to an application.

    Returns: array - Descriptors of the attached files.

    Param Type Description
    instance_id string Application instance

    Collections

    Functions for collections' management based on MongoDB.

    aggregate_collection

    Run an aggregation query over a collection. Aggregation is a powerful, yet sometimes complex, way to calculate aggregated values of a MongoDB collection. It is recommended to read with care the MongoDB documentation.

    Throws: Invalid pipeline at position N.

    Returns: array - The list of the documents, result of this aggregate (the system limits the result to the 1000 first documents).

    Param Type Description
    name string Name of a collection
    pipeline object / array First pipeline. An aggregation requires at least one pipeline. This can be a single object or an array of objects, each object being a pipeline.
    pipelineX object / array (optional) Second and other optional pipelines. This can be a single object or an array of objects, each object being a pipeline.

    Example

    ${aggregate_collection('my_collection', {"$match":{"customerId":123456}},{"$group":{"_id":{"user":"$user"}}, "total":{"$sum":"$amount"}}, {"$project":{"user":"$_id.user", "total":"$total", "_id":0}},{"$sort":{"total":1}},{"$limit":100})}
    

    count_objects

    Count documents verifying a condition in a collection.

    Throws: Cannot count objects with an empty condition.

    Returns: integer - Number of documents matching the where clause.

    Param Type Description
    where object A where clause. Please refer to the MongoDB documentation
    name string Name of a collection.

    create_collection

    Create a new collection.

    Returns: boolean - Collection successfully created or not.

    Param Type Description
    name string Name of a collection.
    is_public boolean If true the collection can be accessed publicly, without checking rights.
    is_readonly boolean If true the collection can only be modified by an administrator of the customer account.

    drop_collection

    Drop the content of a collection: the collection still exists, but with an empty content. Use with care!

    See remove_collection

    Returns: boolean - Collection successfully dropped or not.

    Param Type Description
    name string Name of a collection.

    import_objects (deprecated)

    Import objects in a collection from a file.

    Deprecated: See https://docs.mongodb.com/v3.0/core/write-operations/

    Throws: Uploaded file X doesn't exist.

    Returns: integer - The number of imported objects.

    Param Type Description
    file string Reference of an uploaded file.
    name string Name of a collection.
    separator string Separator to be used during the CSV parsing or an object to pass other configuration items.
    drop boolean (optional) true to drop the collection if it already exists before the import. false otherwise (objects will be added to the existing collection).

    Example

    ${import_objects( "95933380-75ec-11e2-8875-123139322be6","test_import_valeur_vide",",","true")}
    
    ${import_objects( "95933380-75ec-11e2-8875-123139322be6","import_virgule_sanscote",",","true")}
    

    import_objects

    Import objects in a collection from a file.

    See https://docs.mongodb.com/v3.0/core/write-operations/

    Throws: Uploaded file X doesn't exist.

    Returns: integer - The number of imported objects.

    Param Type Description
    file string Reference of an uploaded file.
    name string Name of a collection.
    options object Options to be used during the call, all values are optional.
    drop boolean (optional) true to drop the collection if it already exists before the import. false otherwise (objects will be added to the existing collection).

    options properties

    Name Type Default Description
    format string CSV (optional) Format of the file content, may be CSV or JSON.
    separator string , (optional) Separator between two values (for example ; or ,).
    delimiter string " (optional) Delimiter used to allow values containing the separator character (for example " or '), to include a delimiter in a value, use two delimiters ("" for example).
    empty string "" (optional) Value to be used to represent an empty value (two separators in a row).
    charset string UTF-8 (optional) Character set to be used to read the file content. More information about character sets.
    parse_numbers array (optional) Array of names or indices (zero based) of columns containing numerical values that should be stored as numbers (double). Examples : ["age",3] is asking the loader to parse column with header "age" and the fourth column.
    parse_longs array (optional) Array of names or indices (zero based) of columns containing long values that should be stored as longs. Examples: ["age",3] is asking the loader to parse column with header "age" and the fourth column.
    trim boolean (optional) true to trim values before inserting them in the collection. The trimmed value will be the parsed value, with any leading and trailing whitespace removed. Trimming also occurs before decoding numerical values. false to keep values unchanged.

    Example

    ${import_objects( "95933380-75ec-11e2-8875-123139322be6","import_point_virgule",{"separator":";","delimiter":"\""},"true")}
    
    ${import_objects( "95933380-75ec-11e2-8875-123139322be6","import_point_virgule",{"separator":";","delimiter":"\"","empty":null},"true")}
    

    inject_objects

    Retrieved objects (using list_objects() or save_object()) are never retained in the process data document. So they will not be accessible in the next task. To be able to access objects in a future task, you have to inject them into the data document using this function.

    See save_object, list_objects

    Returns: array - An array of injected objects. These objects will be kept in the process data document. Please be aware that a data document has a maximum size, if it grows bigger than that maximum size, the process will be stopped.

    Param Type Description
    variable string Name of the variable containing objects retrieved from a collection.
    filter string (optional) Default: no filter. List (comma separated names) of the fields of variable objects that should be kept in the injected objects.

    Example

    <#assign objects = list_objects({},"my_collection")>
    ${inject_objects(objects, "firstname", "lastname")}
    

    list_objects

    Retrieve objects from a collection.

    See load_object

    Throws: - Unable to parse skip index or limit value. - Cannot list objects with an empty condition.

    Returns: array - An array of retrieved objects. Returned objects are not automatically inserted into the data document of the process. Please see inject_objects for further information.

    Param Type Description
    query object Query to filter objects to be retrieved. If an array is used for the orderby section, the order is maintained as values are inserted. Please refer to the MongoDB documentation for further information regarding queries.
    name string Name of a collection.
    first integer (optional) Default: 0. Index of the first object to be retrieved, used when results are paginated.
    limit integer (optional) Default: 1000. Maximum number of objects to be retrieved, used when results are paginated. The maximum value is 1000.

    Example

    ${list_objects( {"a":{$gt:1}},"my_collection")}
    
    ${list_objects( {"$query":{"a":2},"$orderby":{"b":-1}},"my_collection", 30, 10)}  
    
    ${list_objects( {"$query":{"a":2},"$orderby": [{"status":-1}, {"last_name":1}]},"my_collection", 30, 10)} 
    

    load_object

    Load a document from a collection.

    See list_objects

    Throws: Cannot load an object with an empty condition.

    Returns: object - One document matching the where clause; if several documents match the condition, then the first one resulting from the query is returned.

    Param Type Description
    where object Query to retrieve the object. Please refer to the MongoDB documentation.
    name string Name of a collection.

    R_create_index

    Creates indexes on collection.

    Returns: boolean - The result of the create action (true or an error).

    Param Type Description
    id integer id of the collection.
    name string Name of the index.
    keys array JSON Array of keys.
    unique boolean (optional) Default: false. Creates a unique index so that the collection will not accept insertion of documents where the index key or keys match an existing value in the index. Specify true to create a unique index.
    ascending boolean (optional) Default: true. Create an index with ascending order.

    Example

    ${R_create_index(108760, "myidx", ["attr1","attr2"], false, true)}
    Output: true   
    

    R_delete_index

    Remove index on a collection.

    Returns: boolean - The result of the delete operation (true or false).

    Param Type Description
    id integer id of the collection.
    name string Name of the index.

    Example

    ${R_delete_index(108760, "myidx")}
    Output: true  
    

    R_list_indexes

    List of all indexes on a collection.

    Returns: array - JSON Array of indexes.

    Param Type Description
    id integer id of the collection.

    Example

    ${R_list_indexes(108760)}
    Output: [
        {
            "keys": [
            "_id"
            ],
            "unique": false,
            "name": "_id_",
            "ascending": true
        },
        {
            "keys": [
            "attr1",
            "attr2"
            ],
            "unique": true,
            "name": "myidx",
            "ascending": false
        }
    ]
    

    remove_collection

    Remove a collection: the collection, its configuration and all of its documents are deleted. Use with care!

    See drop_collection

    Returns: boolean - Collection successfully removed or not.

    Param Type Description
    name string Name of the collection.

    remove_field

    Remove a field from documents matching a where clause.

    Returns: integer - Number of updated objects.

    Param Type Description
    where object Query to retrieve the object. Please refer to the MongoDB documentation.
    fieldname string Name of a field in the documents of the target collection.
    name string Name of the target collection.
    multi boolean (optional) Advanced option. Modify only the first object retrieved (false) or all objects (true).

    remove_objects

    Remove a subset of objects from a collection.

    Throws: Cannot remove objects with an empty condition.

    Returns: integer - Number of removed objects.

    Param Type Description
    where object Query to retrieve the objects. Please refer to the MongoDB documentation.
    name string Name of the target collection.

    rename_collection

    Rename a collection.

    Returns: boolean - Renaming successul or not. false if old_name doesn't designate an existing collection.

    Param Type Description
    old_name string Current name of the collection.
    new_name string New name of the collection.

    save_object

    Save object(s) in a collection.

    See inject_objects

    Returns: object | array - The object or array saved. The object or array may be different, since it's the representation of the objects returned by MongoDB, after insertion into the collection. Specifically, the _id field of the objects will be returned.

    Param Type Description
    object object / array Object to be saved or an array of objects.
    name string Name of the target collection.

    Example

    ${save_object( {"a":1,"b":"a is one"},"my_collection")}
    
    ${save_object( [{"a":1,"b":"a is one"},{"a":2,"b":"a is two"}],"my_collection")} 
    

    update_field

    Update a field on a subset of the documents in a collection.

    Throws: Cannot update objects fields with an empty condition.

    Returns: integer - Number of objects updated.

    Param Type Description
    where string Query to retrieve the objects. Please refer to the MongoDB documentation
    fieldname string Name of a field in the documents of the target collection.
    name string Name of the target collection.
    multi boolean (optional) Default: false. Advanced option. Modify only the first object retrieved (false) or all objects (true).

    update_objects

    Update a field on a subset of the documents in a collection.

    Throws: - Cannot update objects with an empty condition. - Cannot update objects with a null object.

    Returns: integer - Number of objects updated.

    Param Type Description
    where string Query to retrieve the objects. Please refer to the MongoDB documentation
    variable string -
    name string Name of the target collection.
    multi boolean (optional) Default: false. Advanced option. Modify only the first object retrieved (false) or all objects (true).

    Composite API

    Functions for composite API.

    P_custom_header

    Set an HTTP header for the response of a composite API.

    Param Type Description
    name string Name of the header.
    value string Value of the header.

    set_status

    Set the return HTTP status of a composite API.

    See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

    Param Type Description
    code integer Numerical value of the code. It is strongly recommended to use a valid HTTP code. See the W3C specification for more information on status code standard definition.
    name string (optional) Customized name of the status.
    description string (optional) Customized description for the status.

    Example

    ${set_status(200)}
    
    ${set_status(200,"Success","Your own description")}
    

    File

    File management functions.

    append_file

    Append data to an existing file, or create a new file if no file is mentioned. Only work with uploaded files.

    Returns: string - Identifier of the appended or created file.

    Param Type Description
    fileId string Identifier of the file to be appended. A new file is created if fileId is empty.
    content string Content to be appended.
    charset string (optional) Default: UTF-8. Character set of the content to be appended. More information about character sets

    create_file

    Create a new file. Works only for uploaded files.

    Returns: string - Identifier of the created file.

    Param Type Description
    name string Name of the new uploaded file.
    content string Content to be added to the file.
    options fileoptions Options to create the file.

    create_file (deprecated)

    Create a new file. Works only for uploaded files.

    Deprecated: See create_file

    Returns: string - Identifier of the created file.

    Param Type Description
    name string Name of the new uploaded file.
    content string Content to be added to the file.
    charset string (optional) Default: UTF-8. Character set of the content to be appended. More information about character sets
    contentType string (optional) Default: auto discovered. Media type of the content.

    delete_file

    Delete an existing file. Works only for uploaded files.

    Returns: boolean

    Param Type Description
    fileId string Identifier of the file to be deleted.

    file_replace

    Replace the occurrences of a string in a file and save it. Works only for uploaded files.

    Returns: string - File identifier.

    Param Type Description
    fileId string ID of the file to be modified.
    search string String or regex to matched and replaced.
    replacedBy string Replacement string.
    flag searchflag (optional) Replacement string.
    algorithm algorithm (optional) Default: none. Algorithm to be used to decode the content.
    charset string (optional) Default: UTF-8. Character set of the content to be read. More information about character sets

    R_file_content

    Read the content of a file.

    Returns: string - File content.

    Param Type Description
    fileId string Identifier of the file to be read.
    algorithm algorithm Encoding algorithm.
    charset string (optional) Default: UTF-8. Character set of the content to be read. More information about character sets

    R_file_desc

    Get the metadata describing a file on the platform.

    Returns: filedescriptor - File description.

    Param Type Description
    fileId string Identifier of the file to be read.

    R_file_index_of

    Find the index of the first occurrence of a string in a file.

    Returns: integer - Index of the first occurrence or -1 if nothing found.

    Param Type Description
    fileId string Identifier of the file to be read.
    substring string String to be search in the file content.
    from integer (optional) Default: 0. Index to start from in the file.
    algorithm algorithm Algorithm to be used to decode the content.
    charset string (optional) Default: UTF-8. Character set of the content to be read. More information about character sets

    R_file_last_index_of

    Find the the last occurrence of a string in a file.

    Returns: integer - Index of the first occurrence or -1 if nothing found.

    Param Type Description
    fileId string Identifier of the file to be read.
    substring string String to be search in the file content.
    from integer (optional) Default: 0. Index to start from in the file.
    algorithm algorithm Algorithm to be used to decode the content.
    charset string (optional) Default: UTF-8. Character set of the content to be read. More information about character sets

    R_file_size

    Get the size in KBytes of a file on the platform.

    Returns: integer - Size in KBytes.

    Param Type Description
    fileId string Identifier of the file to be read.

    R_file_substring

    Find the index of the first occurrence of a string in a file.

    Returns: integer - Index of the first occurrence or -1 if nothing found.

    Param Type Description
    fileId string Identifier of the file to be read.
    substring string String to be search in the file content.
    from integer (optional) Default: 0. Index to start from in the file.
    to integer (optional) Default: end of file. Index to stop at in the file.
    algorithm algorithm (optional) Default: none. Algorithm to be used to decode the content.
    charset string (optional) Default: UTF-8. Character set of the content to be read. More information about character sets

    R_read_excel_cells

    Read cells from an Excel worksheet.

    Returns: cellsdescriptor

    Param Type Description
    fileId string Identifier of the Excel file uploaded on the platform.
    cells worksheet Worksheet descriptor listing the cells to be read.

    Example

    // MyWorksheet is a worksheet in an Excel file uploaded with ID fe68f660-df8d-11e1-8a0e-1231390a5172
    
    <#assign cells = [{"worksheet":"MyWorksheet1","cells":[{"col":"1","row":"5"},{"col":"2","row":"5"},{"col":"3","row":"4"}]},{"worksheet":"MyWorksheet2","cells":[{"col":"1","row":"2"},{"col":"2","row":"2"},{"col":"3","row":"2"}]}]>
    
    ${read_excel_cells("fe68f660-df8d-11e1-8a0e-1231390a5172",cells)}
    
    // returns {"MyWorksheet2":{"2":{"1":"1","2":"a value","3":""}},"MyWorksheet1":{"4":{"3":""},"5":{"1":"4","2":"another value!"}}}
    

    save_file (deprecated)

    Overwrite an existing file. Works only for uploaded files.

    Deprecated: Use save_file with options instead.

    Returns: string - Identifier of the file.

    Param Type Description
    fileId string Identifier of the file to be overidden.
    content string New content of the file.
    charset string (optional) Default: UTF-8. Character set of the content to be read. More information about character sets

    save_file

    Overwrite an existing file. Works only for uploaded files.

    Returns: string - Identifier of the file.

    Param Type Description
    fileId string Identifier of the file to be overidden.
    content string New content of the file.
    options fileoptions File options.

    save_file_desc

    Modify the metadata describing a file on the platform.

    Returns: filedescriptor - New metadata of the file.

    Param Type Description
    fileId string Identifier of the file to update.
    metadata filedescriptor New metadata of the file.

    unzip_file

    Unzip a file, and create a new file with the unzipped data. Works only for uploaded files.

    Returns: filedescriptor - Metadata of the new (unzipped) file.

    Param Type Description
    fileId string Identifier of the file to be overidden.

    update_file (deprecated)

    Update file metadata. Works only for uploaded files.

    Deprecated: Use save_file_desc instead.

    Returns: string - Identifier of the file.

    Param Type Description
    fileId string Identifier of the file to be overidden.
    name string New name of the file.
    contentType string New content type of the file.

    zip_file

    Zip an file, and create a new file with the zipped data. Works only for uploaded files.

    Returns: string - Identifier of the new zip file.

    Param Type Description
    fileId string / array Identifier of the file to be overidden or list of files to be added to the zip archive in a JSONArray format.
    name string Name of the new zip file to be created.

    Request

    Functions to manage a process request.

    get_access_url

    Get the URL of the RunMyProcess server.

    Returns: string - URL with or without protocol.

    Param Type Description
    includeProtocol boolean Whether or not including the protocol in the URL.

    Example

    ${get_access_url(true)}
    //Result: https://live.runmyprocess.com/
    
    ${get_access_url(false)}
    //Result: live.runmyprocess.com/
    

    get_custom_list

    Get the content of a custom list.

    Returns: array - List un a JSONArray format.

    Param Type Description
    id string Identifier of a custom list.

    get_i18n

    Internationalization method. Get the translation of a key in a given language. With this method, you can enforce the language type. Unlike the i18n() method, it applies to all process activities, not only to email activities.

    Returns: string - Target translation or defaultValue if nothing found.

    Param Type Description
    key string -
    defaultValue string (optional) Default value if key is not found in language
    language string (optional) Language code (two letters)

    get_next_url

    Provides the URL of a manual task that will be generated when reaching the step stepId. This method can be called outside a manual task's input parameters. In a loop, the returned URL will be set for the next iteration.

    Returns: string - Task URL.

    Param Type Description
    stepId integer The id of the step as defined in the process design
    is_public boolean Use a public task template or not
    context string (optional) Default: web. If context=mobile, the generated URL will be adapted to the the RunMyApp environment

    get_parent_params

    Retrieves all parameters from the parent process request. Do not indicate any target parameter name to inject all parameters directly into the context of the current process request.

    Returns: object - Parent process' parameters.

    get_project_metadata

    Get the metadata of a project.

    Throws: Project not found.

    Returns: object - Project metadata.

    Param Type Description
    projectId integer (optional) Identifier of the project. By default the project of the current process request is used.

    get_request_info

    Describe a process request.

    Throws: Request not found.

    Returns: object - Process request descriptor.

    Param Type Description
    id string (optional) Identifier of the process request to describe. By default the descriptor of the current process request is provided.

    get_task_url

    When used within a manual task's input parameters, provides the URL of the manual task to be generated.

    Returns: string - Task URL.

    Param Type Description
    is_public boolean Use a public task template or not.

    inject_params

    Add the result of the last executed task to the context of a process request.

    Returns: object - Result of the last executed task.

    next_value

    Get the next value of a named and persistent counter. The counter is created and initialized at 0 id it doesn't exists.

    Throws: Counter already being modified, cannot increment it.

    Returns: integer - Next value.

    Param Type Description
    name string Name of the counter.

    P_add_user_to_lane

    Add a user to the given runtime lane.

    See P_remove_user_from_lane

    Throws: Counter already being modified, cannot increment it.

    Returns: array - List of the users id in the lane.

    Param Type Description
    laneId integer Id of the lane.
    userId integer/string Id or login of the user.

    P_delete_project_vault

    Delete a project vault.

    See P_save_project_vault

    Returns: boolean - True if the project vault has been found and deleted, false otherwise.

    P_get_oauth2_token

    Retrieve an OAuth2 service token.

    See P_save_oauth2_token

    Returns: object - The OAuth2 token associated to the specified service. If found this token will contain at least an access_token field. This can be used for example in the token field of an OAuth2 connector configuration: ${P_get_oauth2_token("my_service").access_token}. An OAuth2 service token value depends on the current request execution mode.

    Param Type Description
    service string Name of the OAuth2 service which token is to be retrieved.

    P_load_project_vault

    Retrieve the project vault associated to the project containing the current request.

    See P_save_project_vault

    Returns: object - The current request project vault. A project vault value depends on the current request execution mode.

    P_log

    Equivalent to P_log('FINEST', message).

    Returns: string - Logged message.

    Param Type Description
    message string Message to be logged.

    P_log (with level)

    Logs in the P_message variable of the request and in the Mongo data of the customer. In TEST mode all the levels are logged but in LIVE mode, only SEVERE level is logged. This rule is skipped if the attributes P_log is present in the resource, in this case, the given P_log will be the reference.

    Returns: string - Logged message.

    Param Type Description
    level string Level of the log (SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST).
    message string Message to be logged. The size of the message is limited to 3Kbytes: any bigger message is truncated, and terminated by "(...)"

    P_remove_user_from_lane

    Remove a user from the given runtime lane.

    See P_add_user_to_lane

    Returns: array - List of the users id in the lane.

    Param Type Description
    laneId integer Id of the lane.
    userId integer/string Id or login of the user.

    P_save_oauth2_token

    Modify or create an OAuth2 service token.

    See P_get_oauth2_token

    Returns: object - The updated token associated to the specified service.

    Param Type Description
    service string Name of the OAuth2 service which token is to be modified.
    token object Token object associated to the specified service. This object must contain at least a field name access_token containing the OAuth2 access token. It may also contain a refresh_token field and an expires_in field, containing an OAuth2 refresh token and a token lifetime duration, or any extra fields.

    P_save_project_vault

    Modify or create a project vault.

    See P_load_project_vault

    Returns: object - The updated project vault.

    Param Type Description
    vault object An object representing the vault associated to project containing the current request. This object may contain any fields.

    P_set_request_status

    Set the status of the current request to the statusCode.

    Param Type Description
    statusCode integer 102/201/301/302/400/401

    R_lock

    Create global lock on a customer account to avoid concurrency when accessing a shared resource. This waits for the obtention of the lock if a lock with the same name already exists.

    Datadocument: The use of the method R_lock and/or R_unlock will add in the internal parameter a JSONArray with the key P_locks.

    This JSONArray will contain a list of the following structure:

      P_locks:[{
         name: (name of the lock),
         start: (time stamp when the lock was owned)
      }]
    

    See R_unlock

    Throws: Timeout exception if the request don't get the lock.

    Returns: string - Name of the lock.

    Param Type Description
    lockname string Name of the lock.
    wait_timeout integer (optional) Maximun time to wait to get the lock (in milliseconds). If this number is greater than 40 seconds, the method will wait only 40 seconds.
    exec_timeout integer (optional) Maximun time that the lock could be kept if not release programmatically (in seconds). Default: 1 hour.

    R_read_file_add_lane

    Add lanes allowed to READ the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.

    Param Type Description
    file array/string One or a list of file identifiers.
    lane array/string/number One lane identifier or a list of lane identifiers. Default is the lane of the request.

    R_read_file_add_user

    Add users allowed to READ the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}

    Param Type Description
    file array/string One or a list of file identifiers.
    user array/string/number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user.

    R_read_file_remove_lane

    Remove lanes allowed to READ the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}.

    Param Type Description
    file array/string One or a list of file identifiers.
    lane array/string/number One lane identifier or a list of lane identifiers. Default is the lane of the request.

    R_read_file_remove_user

    Remove users allowed to READ the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}

    Param Type Description
    file array/string One or a list of file identifiers.
    user array/string/number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user.

    R_unlock

    Release a lock acquired with $R_lock(lockname, wait_timeout, exec_timeout)}.

    Datadocument: The use of the method lock and/or unlock will add in the internal parameter a JSONArray with the key P_locks.

    This JSONArray will contain a list of the following structure:

      P_locks:[{
         name: (name of the lock),
         start: (time stamp when the lock was owned),
         end: (time stamp when the lock was released)
      }]
    

    See R_lock

    Returns: string - Name of the lock.

    Param Type Description
    lockname string Name of the lock.

    R_update_file_add_lane

    Add lanes allowed to WRITE/DELETE the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}

    Param Type Description
    file array/string One or a list of files identifiers.
    lane array/string/number One lane identifier or a list of lane identifiers. Default is the lane of the request.

    R_update_file_add_user

    Add users allowed to WRITE/DELETE the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}

    Param Type Description
    file array/string One or a list of file identifiers.
    user array/string/number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user.

    R_update_file_remove_lane

    Remove lanes allowed to WRITE/DELETE the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}

    Param Type Description
    file array/string One or a list of files identifiers.
    lane array/string/number One lane identifier or a list of lane identifiers. Default is the lane of the request.

    R_update_file_remove_user

    Remove users allowed to WRITE/DELETE the file(s).

    Returns: object - The list of lanes and users with the appropriate right for each file in JSON: ie: {<file_id>:{"user":{"READ":[user_ids], "WRITE":[user_ids]}, "lane":{"READ":[lane_ids], "WRITE":[lane_ids]}...}

    Param Type Description
    file array/string One or a list of file identifiers.
    user array/string/number One user identifier, or one user login, or a list of either user identifiers or user logins. Default is the connected user.

    save_custom_list

    Update a custom list with a new content.

    Throws: Custom list not found.

    Returns: array - New content.

    Param Type Description
    listId string Identifier of the custom list to be modified.
    data array New content of the custom list.

    throw

    Throw an error.

    Throws: An error with the given error message.

    Param Type Description
    message string (optional) Error message.

    User

    Functions for user management.

    get_applications

    Get the list of applications authorized to a user. This method can be used in a web interface.

    Returns: array - List of applications.

    Param Type Description
    login string (optional) Default: current user's login. Login of the user for which applications are to be retrieved. By default this is the current user.
    context string (optional) Default: web. Context in which the application can be user: web, mobile or tablet.
    mode string (optional) Default: current execution mode. LIVE will return the applications in LIVE version, ACCEPTANCE the applications in both LIVE and ACCEPTANCE versions, TEST will return an empty array. By default this is the current execution mode.
    tagged boolean (optional) Default: false. return the JSONObject representing the list of user interfaces group by tag if true.

    get_lane_job_number

    Get the expected job number to be done to complete the calculation of the users lane. This expected job number is equals to zero when the lane is fully up to date.

    Returns: integer - Number of expected job.

    Param Type Description
    laneId integer Lane identifier.

    get_lane_users

    Get the list of users pertaining to a lane (result is paginated) in the current execution mode context.

    When called from a LIVE or TEST context, this method will return the list of LIVE users of a lane. When called from an ACCEPTANCE context, this method will return the list of ACCEPTANCE users of a lane.

    Returns: array - List of user's descriptors.

    Param Type Description
    poolId integer Pool identifier.
    laneId integer Lane identifier.
    pageSize integer (optional) Default: 500. Number of users returned.
    first integer (optional) Default: 0. Index for pagination.

    get_lanes

    Get the list of lanes a user pertains to in the current execution mode context. This method can be used in a web interface.

    When called from a LIVE or TEST context, this method will return the list of lanes the user pertains to in LIVE. When called from an ACCEPTANCE context, this method will return the list of lanes the user pertains to in ACCEPTANCE.

    Returns: object - Lane descriptor.

    Param Type Description
    login string (optional) User login / email. Current user by default.

    get_manager (deprecated)

    Get a manager N levels above the designed user. Only searches within a hierarchy of organizations. Only LIVE configuration of lanes will be considered. Therefore this method's result is independant of the execution mode context.

    Deprecated

    Throws: No manager found.

    Returns: string - Login / email of a manager.

    Param Type Description
    login string User login / email.
    level integer (optional) Default: 1. Number of levels of hierarchy.

    get_preferences

    Get the preferences associated to a user.

    Returns: object - User's preferences.

    Param Type Description
    login string (optional) Login of the user for which the preferences shall be retrieved. By default preferences are retrieved for the current user.

    get_user_data

    Get a user's basic information (id, name, profile) from its login.

    Returns: object - Simplified user descriptor.

    Param Type Description
    login string User login / email.

    get_user_metadata

    Get the metadata of a user.

    Returns: object - Public metadata of the user.

    Param Type Description
    login string (optional) User login / email. Current user by default.

    has_right

    Check if a user belongs to a lane in the current execution mode context.

    When called from a LIVE or TEST context, this method will check the LIVE list of users of the lane. When called from an ACCEPTANCE context, this method will check the ACCEPTANCE list of users of the lane.

    Returns: boolean - true if the user belongs to the indicated lane, false if the user is not connected or if he/she does not belong to the lane.

    Param Type Description
    login string (optional) User login / email. Current user by default.
    laneId integer Lane identifier.

    impersonate

    Impersonate another user on the same account: only allowed when the process current user is an account's admin.

    Throws: Impersonification is not allowed for user.

    Returns: string - Login of the impersonated user.

    Param Type Description
    login string Login / email of the user to impersonate.

    is_user_in_lane

    Check if the user belongs to at least one lane of the list.

    Returns: boolean - true if the user belongs to at least one lane, false otherwise.

    Param Type Description
    lanes array List of lane identifiers.

    P_change_metadata

    Change a specfied value of the user's metadata.

    Throws: Malformed Object or CastClassException or Expected value.

    Returns: object - The metadata of the user.

    Param Type Description
    id string login/user_id - Login (email) of the user or its id.
    path string Path of the value to be changed.
    input object New value.

    Example

    ${P_change_metadata("login@email.com", "mydata.field.2", "my new cool value")}
    
    // this will change the second item of the item "field" of the item "mydata", its new value will be "my new cool value".
    

    P_change_preferences

    Change a specfied value of the user's preferences.

    Throws: Malformed Object or CastClassException or Expected value.

    Returns: object - The preferences of the user.

    Param Type Description
    id string login/user_id - Login (email) of the user or its id.
    path string Path of the value to be changed.
    input object New value.

    Example

    ${P_change_preferences("login@email.com", "mydata.field.2", "my new cool value")} 
    
    // this will change the second item of the item "field" of the item "mydata", its new value will be "my new cool value".
    

    save_preferences

    Modify the preferences of the current user.

    Returns: boolean - Login of the user.

    Param Type Description
    prefs object New preferences.

    save_user_metadata

    Modify the metadata of a user.

    Returns: boolean - Login of the user.

    Param Type Description
    login string (optional) User login / email. Current user by default.
    metadata object New metadata.

    unblock_user

    Change a user's status from blocked to active.

    Throws: Unable to retrieve user.

    Returns: boolean - Login of the user.

    Param Type Description
    login string Login / email of the user to unblock.

    Utilities

    Utilities functions.

    bubble_babble

    Bubble/Babble encoder that provides a human readable encoding of an input stream.

    See Bubble/Babble

    Returns: string - Encoded string.

    Param Type Description
    input string Input string.

    cipher

    Returns the ciphered version of input as well as an initialization vector.

    See decipher, generate_key

    Returns: object - An Object containing the initialization vector (iv field) and the ciphered version of input (ciphered field).

    Param Type Description
    input string Input string to be ciphered encoded in UTF-8.
    key string The key material of the secret key. It must be a valid key for the specified algorithm.
    algorithm string (optional) Default: AES/CBC/PKCS5Padding. Algorithm to be used. Only algorithm derived from AES are supported.

    csv_to_json

    Converts an CSV string into a JSON string. If no header row is present in the input, the result will be an array of arrays. If a header row is present and the option 'header' is set to true, the result will be an array of objects having the column names from the header row as attributes.

    Returns: string - The resulting JSON data as string.

    Param Type Description
    input object CSV to convert to JSON format.
    options object (optional) Options to be used for defining the JSON parsing behavior.

    options properties

    Param Type Description
    header boolean (optional) Default: false. Set to true if a header row is present in the input.
    trim boolean (optional) Default: false. If set to true, leading and trailing white spaces will be removed from each entry in the input.
    charset string (optional) Default: UTF-8. The character set used in the input. More information about character sets
    delimiter string (optional) Default: ". The delimiter used for entries potentially containing special characters like line break or the separator.
    separator string (optional) Default: ,. The column separator used in the input - e.g. ; or \t for SCSV or TSV.
    empty string (optional) Default: "" (empty string). value to be used to represent an empty or not existing value.
    parse_numbers array (optional) A JSON array of column names or indices (zero based) containing numerical values that should be stored as numbers. Examples: ["ratio", 3] will parse the column with header "ratio" and the fourth column.
    parse_longs array (optional) A JSON array of column names or indices (zero based) containing numerical values that should be stored as longs. Examples: ["age", 1] will parse the column with header "age" and the second column.
    parse_booleans array (optional) A JSON array of column names or indices (zero based) containing values that should be stored as booleans. Examples: ["ready", 2] will parse the column with header "ready" and the third column.

    Example

    <#assign no_header = '1,true,hello\n2,false,world'>
    ${csv_to_json(no_header)}
    
    //returns [["1", "true", "hello"], ["2", "false", "world"] - without parsing information, all data is handled as string
    
    <#assign no_header_parse = '1,true,hello\n2,false,world'>
    <#assign options = {"parse_longs":[0], "parse_booleans":[1]}>
    ${csv_to_json(no_header_parse, options)}
    
    //returns [[1, true, "hello"], [2, false, "world"]] 
    
    <#assign header_parse = 'longValue;booleanValue;stringValue\n1;true;hello\n2;false;world'>
    <#assign options = {"header":true, "separator":";", "parse_longs":["longValue"], "parse_booleans":["booleanValue"]}>
    ${csv_to_json(header_parse, options)}
    
    //returns [{"longValue":1, "booleanValue":true, "stringValue":"hello"}, {"longValue":2, "booleanValue":false, "stringValue":"world"}] 
    

    date_format

    Modify the format of a date. This method can be used in a web interface.

    Returns: string - Formatted date.

    Param Type Description
    date string Date to be formatted.
    initial_format string Initial format.
    target_format string Target format.

    date_offset

    Return the a date +/- a number of days. This method can be used in a web interface.

    Returns: string - Formatted and offset date.

    Param Type Description
    date string Initial date as a string.
    offset integer (optional) Default: 0. Ofset in days.
    format string (optional) Default: yyyy-MM-dd. Format of the initial date.

    decipher

    Returns the deciphered version of the ciphered string provided in input.

    See cipher, generate_key

    Returns: object - Deciphered string.

    Param Type Description
    input string Ciphered string.
    iv string The initialization vector.
    key string The key material of the secret key. It must be a valid key for the specified algorithm..
    algorithm string (optional) Defaut: AES/CBC/PKCS5Padding. Algorithm to be used. Only algorithm derived from AES are supported.

    decode

    Returns the decoded version of the encoded string provided in input. This method can be used in a web interface.

    See encode

    Returns: object - Decoded string.

    Param Type Description
    algorithm string Algorithm to be used. Only algorithm "Base64" is supported.
    input string Encoded string.

    encrypt

    Returns the encrypted version of the string provided in input. This method can be used in a web interface.

    Returns: string - The encrypted version of the string provided in input.

    Param Type Description
    algorithm string (optional) Default: BASE64/MD5/SHA1/SHA256. Algorithm to be used.
    input string Input string to be encrypted.
    output_type string (optional) Default: CHAR/HEXA.

    Example

    ${encrypt('BASE64','mytext','HEXA')}
    ${encrypt('SHA1,BASE64', nonce+created+WS_password, 'CHAR')}
    

    generate_key

    Generate a secret key based on a password and possibly an algorithm.

    See cipher, decipher

    Returns: string - A secret key.

    Param Type Description
    paswword string Password used as a salt to generate the key.
    algorithm string (optional) Default: AES. Algorithm to be used to generate the key.

    get_date

    Format a timestamp in seconds into a date. This method can be used in a web interface.

    Returns: string - Formatted date.

    Param Type Description
    seconds integer Timestamp in seconds.
    format string (optional) Default: yyyy-MM-dd. Target format.

    get_random

    Returns a random number generated by a uniform distribution. This method can be used in a web interface.

    Returns: float - Random number with 6 decimals.

    get_random_gaussian

    Returns a random number generated by a gaussian distribution parameterized by its mean and standard deviation. This method can be used in a web interface.

    Returns: float - Random number with a gaussian distribution with 6 decimals.

    Param Type Description
    average string Average of the Gaussian distribution.
    stdv string Standard deviation of the Gaussian distribution.

    get_time

    Transform a date into a timestamp. This method can be used in a web interface.

    Returns: integer - Number of seconds elapsed between January 1st 1970 and date.

    Param Type Description
    date string Date to be transformed.
    format string (optional) Default: yyyy-MM-dd. Format of the start date.

    json_to_csv

    Converts an array of either JSON objects or arrays to a CSV string. The contained JSON objects must only consist of simple types - no nested objects are allowed. Arrays also must only consist of simple types. The line end is CRLF.

    Parameters:

    Name Type Argument Description
    input object JSON array to convert to CSV format
    options object \ options to be used for defining the CSV format

    options Properties:

    Name Type Argument Default Description
    header boolean \ false if set to true, the JSON attribute names will added as header row at the beginning (only effective when input is an array of JSON objects)
    trim boolean \ false if set to true, leading and trailing white spaces will be removed from strings
    separator string \ , the column separator - e.g. ; or \t to get a SCSV or TSV
    empty string \ "" (empty string) value to be used to represent an empty value (null or a not existing attribute)
    decimal_separator string \ , the decimal separator to be used for numbers with a fraction
    parse_dates object \ a JSON object having the attribute names to be handled as date as attributes and the date/time patterns to be applied as value (only effective when input is an array of JSON objects). Example: {"birthday":"MM/dd/yyyy"}

    Returns: the resulting CSV data as string

    Type: string

    Examples

    <#assign arrays = [[1, true, "hello"], [null, false, "world"]]>
    ${json_to_csv(simple)}
    //returns 1,true,"hello"CRLF,false,"world"
    
    <#assign objects = [{"birthday":1138752000, "favourite_color":"green", "score":65.7},
      {"birthday":"1187136000", "favourite_color":"blue", "score":70}]>
    <#assign options = {"header":true, "separator":";", "decimal_separator":".", "parse_dates"={"birthday":dd.MM.yyyy}}>
    ${json_to_csv(objects, options)}
    //returns birthday;favourite_color;scoreCRLF01.02.2006;"green";65.7CRLF15.08.2007;"blue";70
    

    load

    Convert/parse input to JSON according to its original format.

    Parameters:

    Name Type Argument Default Description
    input string content to be loaded
    format string \ content format, can be one of: TEXT, JSON, XML, EDI, CSV_HEAD, CSV_NOHEAD, ESKV, URL
    charset string \ UTF-8 character set of the content to be parsed. More information about character sets
    options object options to be used for CSV_HEAD or CSV_NOHEAD format only

    options Properties:

    Name Type Argument Default Description
    separator string \ ; separator between two values (for example ; or ,)
    delimiter string \ " delimiter used to allow values containing the separator character (for example " or '), to include a delimiter in a value, use two delimiters ("" for example)
    empty string \ "" value to be used to represent an empty value (two separators in a row)
    parse_numbers array \ array of names or indices (zero based) of columns containing numerical values that should be stored as numbers. Examples: ["age",3] is asking the loader to parse column with header "age" and the fourth column.

    Returns: a variable containing the loaded content

    Type: object

    now

    Get the current date and time. This method can be used in a web interface.

    Parameters:

    Name Type Argument Default Description
    format string \ yyyy-MM-dd Formatting description

    Returns: Current date

    Type: string

    P_json_accumulate

    Add a field to an existing object. If the given field already exists, it will be transformed into an array (if not already an array), and the new value will be added to this array.

    Parameters:

    Name Type Argument Default Description
    object object to add a field to
    field name of the field to be added
    value value to be associated to the new field, may be a string, a number, an object
    forceString \ false hint to force the value to be considered as a string, even if it's a number or another type of object

    See:

    • P_json_putAll
    • P_json_put
    • P_json_accumulateAll

    Returns: the object with the new field

    Type: object

    Examples

    <#assign myObject=P_json_accumulate( myObject, "firstname", myValue, true )>
    <#assign myObject=P_json_accumulate( myObject, "age", 32 )> // add age = 32
    <#assign myObject=P_json_accumulate( myObject, "status", 404, true )>  // add status="404"
    <#assign myObject=P_json_accumulate( myObject, "b", 3 )>  // before: {'a':1,'b':2}, after: {'a':1,'b':[2,3]}
    

    P_json_accumulateAll

    Add all fields of an object into another object.

    Parameters:

    Name Type Description
    object the object to add the new fields to
    object2 the object to copy fields from

    Returns: an object containing all fields of object and object2. If both objects have some fields in common, object2 fields will be added to object fields previously transformed into an array if needed

    Type: object

    P_json_parse

    Parse an expression representing a JSONObject, into an object.

    Parameters:

    Name Type Description
    value the serialized object to be parsed

    Returns: an object, result of the parsing

    Type: object

    Example

    <#assign myObject=P_json_parse( "{'b':1","a":2}" )>
    

    P_json_put

    Add a field to an existing object.

    Parameters:

    Name Type Argument Default Description
    object object object to add a field to
    field string name of the field to be added
    value object value to be associated to the new field, may be a string, a number, an object
    forceString boolean \ false hint to force the value to be considered as a string, even if it's a number or another type of object

    See:

    • P_json_put_ext
    • P_json_putAll
    • P_json_accumulate
    • P_json_accumulateAll

    Returns: the object with the new field

    Type: object

    Examples

    <#assign myObject=P_json_put( myObject, "firstname", myValue, true )>
    <#assign myObject=P_json_put( myObject, "age", 32 )> // add age = 32
    <#assign myObject=P_json_put( myObject, "status", 404, true )>  // add status="404"
    

    P_json_put_ext

    Add a field to an existing object. This also works for nested objects. Objects within the path, that don't exist, will be created.

    Parameters:

    Name Type Argument Default Description
    object object object to add a field to
    field string name of the field to be added or the path separated by .
    value object value to be associated to the new field, may be a string, a number, an object
    forceString boolean \ false hint to force the value to be considered as a string, even if it's a number or another type of object

    See:

    • P_json_put
    • P_json_putAll
    • P_json_accumulate
    • P_json_accumulateAll

    Returns: the object with the new field

    Type: object

    Examples

    <#assign myObject=P_json_put_ext( myObject, "firstname", myValue, true )>
    <#assign myObject=P_json_put_ext( myObject, "age", 32 )> // add age = 32
    <#assign myObject=P_json_put_ext( myObject, "status", 404, true )>  // add status="404"
    <#assign myObject=P_json_put( myObject, "status.code", 404 )>  // add code=404 to attribute myObject.status; status will be created if not existing
    

    P_json_putAll

    Add all fields of an object into another object.

    Parameters:

    Name Type Description
    object the object to add the new fields to
    object2 the object to copy fields from

    Returns: an object containing all fields of object and object2. If both objects have some fields in common, object2 fields will be kept

    Type: object

    P_json_remove

    Remove a field from an object.

    Parameters:

    Name Type Description
    object object to remove a field from
    field field to be removed

    Returns: the object with the given field removed if found, the same object otherwise

    Type: object

    Example

    <#assign myObject=P_json_remove( myObject, "b" )>  // before: {'a':1,'b':2}, after: {'a':1}
    

    P_json_remove_ext

    Remove a field from an object. This also works for nested objects. If attributes in the path don't exist, nothing will be done.

    Parameters:

    Name Type Description
    object object to remove a field from
    field field to be removed or path to the field to remove separated by .

    Returns: the object with the given field removed if found, the same object otherwise

    Type: object

    Examples

    <#assign myObject=P_json_remove_ext( myObject, "b" )>  // before: {'a':1,'b':2}, after: {'a':1}
    <#assign myObject=P_json_remove_ext( myObject, "b.x" )>  // before: {'a':1,'b':{'x':1,'y':2}}, after: {'a':1,'b':{'y':2}}
    

    P_json_stringify

    Serialize an object into a JSON string.

    Parameters:

    Name Type Description
    object object to be serialized

    Returns: a string, representing the serialized object

    Type: string

    P_markdown_to_html

    Converts a Markdown document into its HTML representation.

    Parameters:

    Name Type Argument Description
    content string Document to process
    options object \ An object to pass some options. css and title are the two possible options. css can be used to specify a css file url or inlined css. title is used to give the resulting Html document title.

    Returns: Html representation of the Markdown document

    Type: string

    Examples

    ${markdown_to_html(content, {"title":"My Title", "css":"http://server.com/style.css"})}
    
    ${markdown_to_html(content, {"title":"My Title", "css":"*{font:15px}"})}
    

    P_quoted

    Convenient method to quote a string (this includes the backslash of all quote inside the string but also the carriage return...).

    Parameters:

    Name Type Argument Default Description
    input string the string value to quote
    quote string \ ' the character used to quote (default is simple quote ')

    Returns: a quoted string

    Type: string

    P_to_array

    Returns a JSONArray containing the content associated to a certain key in a JSONObject. This method is particularly useful to retrieve the result of Web service call in a clean structure.

    Parameters:

    Name Type Description
    json_object JSONObject JSONObject to parse
    key string key

    Example

    <#assign var1 = {"feed":{"entry":[{"title":"John"},{"title":"Mathew"}]}}>
    ${P_to_array(var1.feed,"entry")}
    //returns [{"title":"John"},{"title":"Mathew"}]
    
    <#assign var2 = {"feed":{"entry":{"title":"John"}}}>
    ${P_to_array(var2.feed,"entry")}
    //returns [{"title":"John"}]
    
    <#assign var3 = {"feed":{}}>
    ${P_to_array(var3.feed,"entry")}
    //returns []
    

    password_digest

    Returns the encrypted version of a password that can be used in a Digest authentication.

    Parameters:

    Name Type Description
    password string

    Type: string

    R_encode

    Returns the encoded version of the string provided in input.

    Parameters:

    Name Type Argument Default Description
    encoding string Encoding to be used. BASE64, BASE64URL or URL
    input string String to encode
    result string \ CHAR Type of result expected: characters (CHAR) or hexadecimal (HEXA).

    See:

    • decode

    Returns: Encoded string

    Type: object

    R_hmac_hash

    HMAC is a keyed-hash message authentication code. A common use case is the generation of a signature for AWS platform requests.

    Parameters:

    Name Type Argument Default Description
    data string Data to be signed
    key string -
    algorithm string \ SHA256 SHA256 (default), SHA1 or MD5
    encoding string \ BASE64 BASE64 (default), BASE64URL or HEXA

    Returns: Data signed

    Type: string

    R_rsa_hash

    Generating RSA digital signature specifying the algorithm & encoding.

    Parameters:

    Name Type Argument Default Description
    data string Data to be signed
    key string The private key readers supports PEM files with PKCS#8 or PKCS#1 encodings. It doesn't support encrypted PEM files
    algorithm string \ SHA256 SHA256 (default), SHA1 or MD5
    encoding string \ BASE64 BASE64 (default), BASE64URL or HEXA

    Returns: Data signed

    Type: string

    safe_get

    Returns the value of the key in the current context or defaultValue when key is undefined.

    Parameters:

    Name Type Argument Default Description
    key string -
    defaultValue string Default value if no value exists for key
    encoding string \ NONE Encoding to be applied to the retrieved value

    Type: string

    timestamp

    Get a timestamp. This method can be used in a web interface.

    Parameters:

    Name Type Argument Default Description
    unit string \ MILLISEC Unit of the timestamp (SECOND or MILLISEC)

    Returns: Timestamp

    Type: integer

    to_xml

    Transform a JSON object into a XML. Fields starting with @ will be output as XML attributes. This method can be used in a web interface.

    Parameters:

    Name Type Description
    root string Name of the root element in the resulting XML. If the input object has only one child, pass an empty string as root to use this child as an xml root
    input object Input object

    Returns: XML transform of input

    Type: string

    transpose

    Transposition method of an array (in the application widget sense). This method can be used in a web interface.

    Parameters:

    Name Type Description
    input object JSON object associating a variable (the column) to a JSON array representing the values in the column or JSONArray of JSONObjects representing the values of the lines

    Returns: Transposition of input (columns become rows and vice versa)

    Type: string

    Example

    <#assign rows=[{"a":"a1","b":"b1"},{"a":"a2","b":"b2"}]>
    <#assign to_columns = transpose(rows)>
    //to_columns : {"a":["a1","a2"],"b":["b1","b2"]}
    
    <#assign columns={"a":["a1","a2"],"b":["b1","b2"]}>
    <#assign to_rows = transpose(columns)>
    //to_rows : [{"a":"a1","b":"b1"},{"a":"a2","b":"b2"}]
    

    uuid()

    Generate a universally unique identifier or UUID.

    Returns: a UUID

    Type: string