String.Format execution problems

Last Year
Andread
Business rules

Summary

           


There is a problem when using the function String.Format with five (5) or more parameters: the function will not work when the string parameter is managed as a variable. Using less parameters will not generate this problem.

To ensure its correct execution, it is necessary to:
- Include the Culture as a first parameter
- Include quotation marks after the variable

Applies to

Automation projects from Bizagi 11.0 or higher.

What you need to do

           

Below you will find two options when the string parameter is a variable, in this case sMsg or when you use the string directly as a parameter.

1. Use the String.Format method including the culture and quotation marks after the string parameter:

sTemplate = "this {0} is {1} an {2} example {3}.";      
sMsg = System.String.Format(System.Globalization.CultureInfo.CurrentCulture, sTemplate + "", "Value1", "Value2", "Value3", "Value4");

2. Use the String.Format method including the culture and the string as a parameter:

sMsg = System.String.Format(System.Globalization.CultureInfo.CurrentCulture, "this {0} is {1} an {2} example {3}.", "Value1", "Value2", "Value3", "Value4");

    

If you follow these instructions carefully the problem should be solved and the function should be working properly in runtime. In case you are warned still as shown below, skip this warning.

 

The log of the expressions that must be changed is found in the project's Trace Folder

C:\Bizagi\Projects\[Projectname]\Trace 

The log of the expressions that must be changed is found in the project's Trace Folder

C:\Bizagi\Projects\[Projectname]\Trace 

Rate this Article:

Details

Last Modified:Last Year
Last Modified By: Andread
Type: ERROR
Level: Advanced
Rated 5 stars based on 1 vote
Article has been viewed 1.6K times.

Options