Page tree
Skip to end of metadata
Go to start of metadata

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.

        <Script Language="JavaScript" FileName ="testScript.js"/>
        <MoveField SourceField="32" TargetField="48" />
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:

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