AnsweredAssumed Answered

Javascript Syntax

Question asked by jasonarnold2721 on May 21, 2014
Latest reply on Jan 6, 2018 by mmorthala189353
Can anyone help me with the following script? In essence, I have created a map function that pulls in the state and country for 3 seperate N4xx segments in an EDI 850 MAP.  I am looking at the state value (N402) and if it = 'PR' I am setting the country also to 'PR'. If not I am passing the original values straight through.

My attempt at the code looks like this:

if (N402(ST) = 'PR') {REGIO(WE) = 'PR' and LAND1(ST) = N402(ST)};
else {REGIO(WE) = N404(ST) and LAND1(WE) = N402(ST)};
endif;

if (N402(SN) = 'PR') {REGIO(ZR) = 'PR' and LAND1(ZR) = N402(SN)};
else {REGIO(ZR) = N404(SN) and LAND1(ZR) = N402(SN)};
endif;

if (N402(EU) = 'PR') {REGIO(ZE) = 'PR' and LAND1(ZE) = N402(EU)};
else {REGIO(ZE) = N404(EU) and LAND1(ZE) = N402(EU)};
endif;


Here is the configuration.

0EM40000000PaIk

This is the error:


Test execution of 850 Inbound completed with errors. Embedded message: [Function: Check for PR State/Country, Scripting]: Error executing custom script: sun.org.mozilla.javascript.internal.EvaluatorException: missing ; before statement (#1) in at line number 1; Caused by: sun.org.mozilla.javascript.internal.EvaluatorException: missing ; before statement (#1) in at line number 1

Thanks for any help with this!

Outcomes