-
Notifications
You must be signed in to change notification settings - Fork 1
FormatString
Takes an array of values or variables and formats to the input of the Format parameter. For example, if you wanted to format an address you could do the following:
SpecName = "CSZ"
Format = "{0}, {1} {2}-{3}"
Params = {City}{State}{Zip}{6746}
Parameter notes: The , represents a comma. The City, State and Zip in the Params parameter are variables in the Pageflex project. The 6746 is a hard coded value.
The output would be: Bloomington, MN 55349-6746
SpecName (multiple) The name of the variable for operation result assignment
Format (multiple) The format string to apply to all parameters. Ex: {0} in the {1}
Params (constant) The parameter array applied to the format. Ex: {Variable}{Text}
ErrorMessage (multiple | optional) The error message to return when any error occurs.
All values bracketed in {} are first evaluated as project variables. If the variables are not found it is treated as a hard coded string value. Params are zero based index. Meaning the {0} would be the first item bracketed in the Params parameter.
public static void FormatString(string SpecName, object Format, object Params, object ErrorMessage)
{
Break();
try
{
Variable(SpecName).Value = String.Format((string)Format, ParseArray(Params));
}
catch (Exception ex)
{
throw new Four51ActionsException(ex.Message, (string)ErrorMessage);
}
}