Page 1 of 1

Syntax problem on IF Statement

Posted: Thu Feb 16, 2017 10:16 am
by gleary@amports.com
I am getting a red "X" stating a missing semicolon on my IF statements. This is on a ONROWCLICK. If I put the semicolon as

IF (Brand == "VW"); {CC = '55VW';}

It is happy, but does not work because of the missing condition. Been staring and trying on this one way to long. Below is the code as I expect it to work.

pui.set("S_VIN", getObj("Grid1").grid.getCellValue(row, 6));
pui.set("Brand", getObj("Grid1").grid.getCellValue(row, 0));
IF (Brand == "VW") {CC = '55VW';}
IF (Brand == "Audi") {CC = '55AU';}
IF (Brand == "Bentley") {CC = '55BM';}
VINp = get("S_VIN");
CoClVINp = CC + VINp;
Atrium.launchURL('/profoundui/auth/start?atrium_item=219&p1='+CoClVINp+'&l1=21', 'VIN Inquiry');

Re: Syntax problem on IF Statement

Posted: Thu Feb 16, 2017 10:23 am
by Glenn
JavaScript is case sensitive. Your "IF" statement needs to be "if". The JavaScript interpreter would probably see "IF ()" as a call to a function named "IF".

Glenn

Re: Syntax problem on IF Statement

Posted: Thu Feb 16, 2017 10:59 am
by gleary@amports.com
Thank you Glenn. I was going to try that too, and got side tracked. I knew it was an easy one.