Page 1 of 1

Intervals of variables error

PostPosted: Sat May 14, 2016 7:56 pm
by Dixan
I was trying to do some group intervals but the program doesn´t accept it.
Ex: if I say:
if "[EntradaTexto1] < 80 OR [EntradaTexto1] > 60"
SetVar "[EntradaTexto2]" "250 mg"
else
if "[EntradaTexto1] < 60 OR [EntradaTexto1] > 40"
SetVar "[EntradaTexto2]" "500 mg"
else
if "[EntradaTexto1] < 40 OR [EntradaTexto1] > 10"
SetVar "[EntradaTexto2]" "750 mg"
else
endif

BUT, the first group invalidate the others ´cause when I said <80 it define in lt all numbers under 80 until 0. So I always get the same answer. Help me please. :(

Re: Intervals of variables error

PostPosted: Sun May 15, 2016 5:29 am
by Gaev
Dixan:

1) I believe you meant to use IfEx and not If

2) You need to use AND instead of OR

3) If your ranges are 61 to 80, 41 to 60, 11 to 40, you need to use <= instead of <

4) Always a good idea to indent your nested If/Else/EndIf code blocks ... that way, you can easily see missing Else/Endif pairs ... you were missing a couple ofl EndIf commands

5) Note that your code has not set a value for [EntradaTexto2] when [EntradaTexto1] is outside the range 11 to 80

Code: Select all
IfEx "[EntradaTexto1] <= 80 AND [EntradaTexto1] > 60"
   SetVar "[EntradaTexto2]" "250 mg"
Else
   IfEx "[EntradaTexto1] <= 60 AND [EntradaTexto1] > 40"
      SetVar "[EntradaTexto2]" "500 mg"
   Else
      IfEx "[EntradaTexto1] <= 40 AND [EntradaTexto1] > 10"
         SetVar "[EntradaTexto2]" "750 mg"
      Else
         ... set value when [EntradaTexto1] <= 10 ... and also when [EntradaTexto1] > 80
      EndIf
   Endif
Endif

Re: Intervals of variables error

PostPosted: Sun May 15, 2016 10:12 am
by Dixan
Thanks Gaev. You are so helpful. I got it now. In Holguin. Cuba, were I live, I don´t know anybody who use Neosoft. I´m learning by myself. And I´m using the old 5.5.3b version. I can´t get a new one. Thanks again.