Alpha1980
Novice
Feb 5, 2007, 6:35 PM
Post #3 of 4
(377 views)

Re: [KevinR] If/else statements to create variables
[In reply to]

Can't Post


Thanks once again Kevin. :) I've tried to write a script using your guidance but I ended up pulling my hair out. :( I have written the logic below in plain English for what I want to do. Would this be easy to translate into perl? I appreciate any advice. Thanks.
if $critical has a value of emergency create $charge and give it a value of 1 if $critical does not have a value and if $short has a value of yes create $charge and give it a value of 2 if $critical does not have a value and if $short has a value of yes and (if $pshortflow has a value of 0.1, 0.2 or 0.3 and if $pshorthours has a value of 1) or (if $sshortflow has a value of 1 and if $sshorthours has a value of 1) create $subcharge and give it a value of A if $critical does not have a value and if $short has a value of yes and (if $pshortflow has a value of 0.4, 0.5 or 0.6 and if $pshorthours has a value of 2, 3 or 4) or (if $sshortflow has a value of 1 and if $sshorthours has a value of 2, 3 or 4) create $subcharge and give it a value of B if $critical does not have a value and if $long has a value of yes and if $amb does not have a value create $charge and give it a value of 3 if $critical does not have a value and if $long has a value of yes and if $amb has a value of yes and if $amblw has a value of no create $charge and give it a value of 4 if $critical does not have a value and if $long does not have a value and if $amb has a value of yes and if $amblw has a value of no create $charge and give it a value of 5 if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and (if $pambflow has a value of 0.1, 0.2 or 0.3 and if $pambhours has a value of 0.5) or (if $sambflow has a value of 1 or 1.5 and if $sambhours has a value of 0.5) create $subcharge and give it a value of (a) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 1 or 1.5 or if $sambflow has a value of 1 or 1.5 create $subcharge and give it a value of (b) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 1 or 1.5 or if $sambflow has a value of 2 or 2.5 create $subcharge and give it a value of (c) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 1 or 1.5 or if $sambflow has a value of 3 or 3.5 create $subcharge and give it a value of (d) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 1 or 1.5 or if $sambflow has a value of 4, 4.5 or 5 create $subcharge and give it a value of (e) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 2, 2.5, 3 or 3.5 or if $sambflow has a value of 0.5 create $subcharge and give it a value of (f) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 2, 2.5, 3 or 3.5 or if $sambflow has a value of 1 or 1.5 create $subcharge and give it a value of (g) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 2, 2.5, 3 or 3.5 or if $sambflow has a value of 2 or 2.5 create $subcharge and give it a value of (h) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 2, 2.5, 3 or 3.5 or if $sambflow has a value of 3 or 3.5 create $subcharge and give it a value of (i) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 2, 2.5, 3 or 3.5 or if $sambflow has a value of 4, 4.5 or 5 create $subcharge and give it a value of (j) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 4, 4.5, 5 or 5.5 or if $sambflow has a value of 0.5 create $subcharge and give it a value of (k) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 4, 4.5, 5 or 5.5 or if $sambflow has a value of 1 or 1.5 create $subcharge and give it a value of (l) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 4, 4.5, 5 or 5.5 or if $sambflow has a value of 2 or 2.5 create $subcharge and give it a value of (m) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 4, 4.5, 5 or 5.5 or if $sambflow has a value of 3 or 3.5 create $subcharge and give it a value of (n) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 4, 4.5, 5 or 5.5 or if $sambflow has a value of 4, 4.5, 5 or 5.5 create $subcharge and give it a value of (o) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 6, 6.5, 7 or 7.5 or if $sambflow has a value of 0.5 create $subcharge and give it a value of (p) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 6, 6.5, 7 or 7.5 or if $sambflow has a value of 1 or 1.5 create $subcharge and give it a value of (q) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 6, 6.5, 7 or 7.5 or if $sambflow has a value of 2 or 2.5 create $subcharge and give it a value of (r) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 6, 6.5, 7 or 7.5 or if $sambflow has a value of 3 or 3.5 create $subcharge and give it a value of (s) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 6, 6.5, 7 or 7.5 or if $sambflow has a value of 4, 4.5, 5 or 4.5 create $subcharge and give it a value of (t) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 8, 8.5, 9 or 9.5 or if $sambflow has a value of 0.5 create $subcharge and give it a value of (u) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 8, 8.5, 9 or 9.5 or if $sambflow has a value of 1 or 1.5 create $subcharge and give it a value of (v) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 8, 8.5, 9 or 9.5 or if $sambflow has a value of 2 or 2.5 create $subcharge and give it a value of (w) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 8, 8.5, 9 or 9.5 or if $sambflow has a value of 3 or 3.5 create $subcharge and give it a value of (x) if $critical does not have a value and if $amb has a value of yes and if $amblw has a value of no and if $pambhours has a value of 8, 8.5, 9 or 9.5 or if $sambflow has a value of 4, 4.5, 5 or 5.5 create $subcharge and give it a value of (y) if $critical does not have a value and if $long has a value of yes and if $amb has a value of yes and if $amblw has a value of yes create $charge and give it a value of 6 if $critical does not have a value and if $long does not have a value and if $amb has a value of yes and if $amblw has a value of yes create $charge and give it a value of 7
