Wildcards in Calculations
Hello,
From a multiple choice category field with several tens of inputs, I need to check if according to the Status of a client, there are 1 (or 2) out of 3 main type chosen. I've written the calculation below, but I want to have a wildcard (like * in excel) to replace the ### which would always be different choices in the category field, so that it searches if there is any input starting with "A ", etc
Is it possible in podio calculations to have wildcards?
Thanks
var Stat = @Which Statutory events (cat)
var Status = @Status
var C = 0
var A1 = 0
var A2 = 0
var A3 = 0
if (Stat.indexOf("A ####") !=1) {A1 = 1}
if (Stat.indexOf("B ######") !=1) {A2 = 1}
if (Stat.indexOf("C #####") !=1) {A3 = 1}
if (Status == "Premium") {if(A1+A2+A3 >= 2) {C = 1}}
if (Status = "Regular") {if(A1+A2+A3 >= 1) {C = 1}}
C

Hi Mario,
as far as I know wildcards aren't possible in Javascript's .indexOf
Do the # represent how many characters or numbers follow after A, B, C (like A 1234)?
If so you can do it his way:var Stat = @Which Statutory events (cat) var Status = @Status var A1 = 0 var A2 = 0 var A3 = 0 for(var i = 0; i < Stat.length; i++){ if(Stat[i].indexOf("A") == 0 ) {A1 += 1} if(Stat[i].indexOf("B")== 0 ) {A2 += 1} if(Stat[i].indexOf("C") == 0) {A3 += 1} }; Status == "Premium" && (A1+A2+A3 >= 2) ? 1 : Status = "Regular" && (A1+A2+A3 >= 1) ? 1 : 0
Rainer
rg@delosconsulting.com
Please sign in to leave a comment.
Comments
1 comment