Page 1 of 1

Assign default value to mapping only if response is empty

Posted: Tue Mar 22, 2016 5:41 pm
by Moe

I have an API request that returns what should be visible on the page, it works great. My question is if nothing is returned, how do I set a default?

Image


Assign default value to mapping only if response is empty

Posted: Wed Mar 23, 2016 2:31 am
by Vinny B

Does this help? I use it in mapping click the green js

var tweet = value;
var boro = tweet.substring(0, 7);
if (boro === 'MAN ALL') {
output = '"0"';
}
else if (boro === 'BKLYN A') {
output = '"9"';
}
else if (boro === 'BX ALL ') {
output = '"8"';
}
else if (boro === 'QNS ALL') {
output = '"7"';
}
else if (boro === 'SI ALL ') {
output = '"6"';
}
else if (boro === 'MAN 2-A') {
output = '"5"';
}
else if (boro === 'BKLYN 2') {
output = '"4"';
}
else if (boro === 'BX 2-AL') {
output = '"3"';
}
else if (boro === 'QNS 2-A') {
output = '"2"';
}
else if (boro === 'SI 2-AL') {
output = '"1"';
}

return output;


Assign default value to mapping only if response is empty

Posted: Sun Mar 27, 2016 9:01 pm
by Moe

Thanks so much, I didn't realize that the var value was what being passed.