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)};

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

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

Here is the configuration.


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: missing ; before statement (#1) in at line number 1; Caused by: missing ; before statement (#1) in at line number 1

Thanks for any help with this!