« Back to Product

Documentation

IPS_GetPresentationFormat

 string IPS_GetPresentationFormat (string $PresentationID, int $VariableType) 

Parameters

PresentationID

The ID of the presentation, formatted as GUID

VariableType

The variable type for which the format is to be returned (0 (VARIABLETYPE_BOOLEAN): Boolean, 1 (VARIABLETYPE_INTEGER): Integer, 2 (VARIABLETYPE_FLOAT): Float, 3 (VARIABLETYPE_STRING): String)

Returns

The format template of the presentation as string.

Description

The function returns the format template the presentation PresentationID uses to display values of a variable of type VariableType as text, e.g. for GetValueFormatted. The template contains placeholders in curly braces: {VALUE} for the value, parameters of the presentation like {PREFIX} or {SUFFIX} as well as formatting instructions like select, list or ipsnumber, e.g. {VALUE, select, true{On} false{Off}}. The placeholders are not replaced – the parameter values of a variable are returned by IPS_GetVariablePresentation.

If the presentation defines its own group with a format for the variable type (e.g. the value presentation for Boolean), this format is returned, otherwise the general format of the presentation. If neither the group nor the presentation has a format, {VALUE} is returned. If the presentation contains translations, the template is translated if a translation exists. The restrictions of the presentation to specific variable types are not checked.

If the presentation does not exist, the function fails with "Presentation with ID … not found!", for an invalid GUID with "PresentationID … is not a valid GUID". All presentations are returned by IPS_GetPresentations, a single one by IPS_GetPresentation.

Example

echo IPS_GetPresentationFormat('{60AE6B26-B3E2-BDB1-A3A1-BE232940664B}' /* Switch */, VARIABLETYPE_BOOLEAN);
// e.g. returns: {VALUE, select, true{On} false{Off}}

echo IPS_GetPresentationFormat('{3319437D-7CDE-699D-750A-3C6A3841FA75}' /* Value Presentation */, VARIABLETYPE_BOOLEAN);
// e.g. returns: {VALUE, list, list OPTIONS equals Value found{{Caption}} other{{VALUE}}}
Any questions?