BizTalk Error: Value was either too large or too small for an Int32

SYMPTOMS

The error message appears when you use BizTalk’s Cumulative Functoids.
-----------------------------------------
Error Details: “error btm1050: XSL transform error: Unable to write output instance to the following <file:///C:\…..\Map1_output.xml>. Function 'userCSharp:MyConcat()' has failed. Value was either too large or too small for an Int32.”

This problem may occur when the Cumulative Functoid accept a Null input argument.

image

The script detail:

image

RESOLUTION

Change the script to below code:

-----------------
public int MyConcat(double param1)
{
if (param1 > 0 && param1 < 100)
    return (int) param1;
else
                return 0;
}
----------------------