if else if condition not working
-
I’m trying to assign a value of new field to fieldB, if fieldA satisfy the condition equation of fieldB.
(function(){ if(fieldname19>=1&&fieldname19<=1.1) { return fieldname 35; } else if(fieldname19>1.1&&fieldname19<=1.2) { return fieldname 36; } else if(fieldname19>1.2&&fieldname19<=1.3) { return fieldname 37; } else if(fieldname19>1.3&&fieldname19<=1.4) { return fieldname 38; } else if(fieldname19>1.4&&fieldname19<=1.5) { return fieldname 39; } else if(fieldname19>1.5&&fieldname19<=1.75) { return fieldname 40; } else if(fieldname19>1.75&&fieldname19<=2) { return fieldname 41; } })()
I used this code, didn’t work so I modified and used
(function(){ if(fieldname19>=1&&fieldname19<=1.1) return fieldname 28; if(fieldname19>1.1&&fieldname19<=1.2) return fieldname 29; if(fieldname19>1.2&&fieldname19<=1.3) return fieldname 30; if(fieldname19>1.3&&fieldname19<=1.4) return fieldname 31; if(fieldname19>1.4&&fieldname19<=1.5) return fieldname 33; if(fieldname19>1.5&&fieldname19<=1.75) return fieldname 32; if(fieldname19>1.75&&fieldname19<=2) return fieldname 34; })()
and this
(function(){ if(fieldname19<=1.1) { return fieldname 35; } else if(fieldname19<=1.2) { return fieldname 36; } else if(fieldname19<=1.3) { return fieldname 37; } else if(fieldname19<=1.4) { return fieldname 38; } else if(fieldname19<=1.5) { return fieldname 39; } else if(fieldname19<=1.75) { return fieldname 40; } else { return fieldname 41; } })()
(function(){ if(fieldname19>=1&&fieldname19<=1.1) { fieldname185 == fieldname 35; } else if(fieldname19>1.1&&fieldname19<=1.2) { fieldname185 == fieldname 36; } else if(fieldname19>1.2&&fieldname19<=1.3) { fieldname185 == fieldname 37; } else if(fieldname19>1.3&&fieldname19<=1.4) { fieldname185 == fieldname 38; } else if(fieldname19>1.4&&fieldname19<=1.5) { fieldname185 == fieldname 39; } else if(fieldname19>1.5&&fieldname19<=1.75) { fieldname185 == fieldname 40; } else if(fieldname19>1.75&&fieldname19<=2) { fieldname185 == fieldname 41; } })()
(function() { if(fieldname19>=1&&fieldname19<=1.1) { return fieldname185 == fieldname 35; } else if(fieldname19>1.1&&fieldname19<=1.2) { return fieldname185 == fieldname 36; } else if(fieldname19>1.2&&fieldname19<=1.3) { return fieldname185 == fieldname 37; } else if(fieldname19>1.3&&fieldname19<=1.4) { return fieldname185 == fieldname 38; } else if(fieldname19>1.4&&fieldname19<=1.5) { return fieldname185 == fieldname 39; } else if(fieldname19>1.5&&fieldname19<=1.75) { return fieldname185 == fieldname 40; } else if(fieldname19>1.75&&fieldname19<=2) { return fieldname185 == fieldname 41; } })()
and a few others but none worked, maybe I’m using the wrong syntax?
Actually, I had used these conditions in “Define Dependencies”, it successfully showed the result, but the displayed result can’t be used for further calculation, so I had to use “set equation”, please help me out with any of these!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘if else if condition not working’ is closed to new replies.