You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Current »

FIXEdge allows to use JavaScript as a condition on the Business Layer. In order to apply JS condition to the FIX message you should use the Script element.

Example
<Condition>
        <Script Language="JavaScript" FileName ="testScript.js"/>
</Condition>
<Action>
        <MoveField SourceField="32" TargetField="48" />
</Action>
JS condition can be combined with other conditions in usual way.

In order to use the script as a condition it should return the value. In JS every expression returns the value and the result of the script is a value returned by the last run expression. So the boolean value can be returned such a way:

testScript.js
result = false;
if( "Sender" == getStringField(49) )
{
    result = true;
}
result; //last instruction to return result value

Do not use JS elements which modify the message (for example setStringField or transform) as a condition, because it will lead to error that interrupts the script.

When the script is used in the Action section, then error leads to the OnRuleFailEvent element, but when the script is used in the Condition section then it just returns 'false'.

  • No labels