Format String oraext:format-string
In our integration world, sometimes target system requires the data from source system to be formatted in some specific format which may require data from various input fields along with custom data. To do so we generally use concat() function to concatenate data from various fields and some user specific inputs.
Lets take the below example
Suppose we have a predefined format for the output string:
The abc with employeeID: 1234567 has been successfully registered in the system.
Here, name of the employee($empName='abc') and employee id($empId='1234567') are dynamic values. One way to accomplish this, is to use concat().
concat('The ',$empName,' with employeeID: ',$empId,' has been successfully registered in the system.')
Another way we can achieve this, is using oraext:format-string(string,string,string...)
oraext:format-string ('The {0} with employeeID: {1} has been successfully registered in the system.',$empName, $empId)
In above example, first string defines the output format containing place holders({0},{1}). These place holders will be replaced by the subsequent string values($empName='abc', $empId='1234567'). In future, if we need to change the position of these dynamic value in output string, all we need to do is to move the position of these placeholders.
Note: Maximum of 10 arguments are supported for this function.
Nice article
ReplyDeleteThank you :)
DeleteVery well written 👏👏
ReplyDeleteThank you :)
Delete