Post

2 followers Follow
0
Avatar

Calculation isn't work

I am trying to return Yes or No based on a category value but getting syntax error

 

var dummyYes = "Yes";
var dummyNo = "No";
var dummyStatus = @Lead Status
if ((dummyStatus == "Commit") || (dummyStatus == "Onboarding") || (dummyStatus == "Live & Not Paying") || (dummyStatus == "Live & Paying") ) {
dummyYes;
} else {
dummyNo;
}

Mohamed Elmasry

Please sign in to leave a comment.

1 comment

0
Avatar

Hi Mohamed,

add a semicolon after @Lead Status.

var dummyYes = "Yes";
var dummyNo = "No";
var dummyStatus = @Lead Status;
var result = "";
if ((dummyStatus == "Commit") || (dummyStatus == "Onboarding") || (dummyStatus == "Live & Not Paying") || (dummyStatus == "Live & Paying") ) {
result = dummyYes;
} else {
result = dummyNo;
};
result 

or 

var dummyYes = "Yes";
var dummyNo = "No";
var dummyStatus = @Lead Status;
var result = dummyNo;
if ((dummyStatus == "Commit") || (dummyStatus == "Onboarding") || (dummyStatus == "Live & Not Paying") || (dummyStatus == "Live & Paying") ) {
result = dummyYes;

result 

or

var dummyYes = "Yes";
var dummyNo = "No";
var dummyStatus = @Lead Status;
var result = dummyNo;
(dummyStatus == "Commit") || (dummyStatus == "Onboarding") || (dummyStatus == "Live & Not Paying") || (dummyStatus == "Live & Paying") ? dummyYes :  dummyNo;

All 3 do the same. I prefer Option 3. All 3 should work if @Lead Status is a single choice category, if it is a multi choice field you need to use .indexOf():

dummyStatus.indexOf( "Commit") > -1

Rainer

Rainer Grabowski 0 votes