Salesforce

StrBuild (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

StrBuild (Magic xpa 4.x)

Replaces placeholders in a template string with string values.

This function works as follows:

  1. Searches for a @ sign.

  2. If it is found, then the function searches for another @ sign.

  3. Checks if the string between the two @ signs are number.

  4. If it is a number, then the function checks if there is a parameter with that index.

  5. If there is a parameter with that index, then the @number@ is replaced with the parameter value. Otherwise, no replacement is done. So, if you have just @ or @a@ for example, it will be written as is.

Syntax:

StrBuild (string template, Value 1, Value 2, …)

Parameters:

String template – The template in which the values will be placed.
The template contains normal text and placeholders in the format:

@enumeration index@

where: enumeration index specifies the index of the value parameter to use.

Value x – The value to be positioned in enumeration x

Returns:

The result string.

Example:

StrBuild (‘Hello @1@, You have @2@ reports’,A,str(B,’5’))
when A=’world’ and B=20, the function returns: 'Hello world, You have 20 reports’. This example replaces the following concatenated expression: ’Hello ‘&Trim(A)&’, You have ‘&Trim(Str(B,’5’))&’ reports’.

Note:

  • The function trims the parameters' values.

  • This function is useful when using the MlsTrans function, since the StrBuild function enables the translation of complex sentences.

  • To display a @number@ string in the text, a backward slash (\) should be placed before the @number@ string. For example, \@1@ will not be converted.

See also:

How Do I Dynamically Build Complex Text Messages?

The Online and Rich Client Samples projects (program LG20 and RLG20)

Reference
Attachment 
Attachment