Source language: Translate to:

Intervals of variables error

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Intervals of variables error

Postby Dixan » Sat May 14, 2016 7:56 pm

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. :(
Last edited by Dixan on Sun May 15, 2016 10:15 am, edited 1 time in total.
Dix@n
User avatar
Dixan
 
Posts: 51
Joined: Sat May 14, 2016 2:48 pm

Re: Intervals of variables error

Postby Gaev » Sun May 15, 2016 5:29 am

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
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Intervals of variables error

Postby Dixan » Sun May 15, 2016 10:12 am

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.
Dix@n
User avatar
Dixan
 
Posts: 51
Joined: Sat May 14, 2016 2:48 pm


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 1 guest

cron