Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 9:35 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: if then question
PostPosted: January 6th, 2012, 3:02 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
I have to record data from inputs.
Lets say i need all inputs greater then 100 but less then 120 how do i do that?

I tried the if (var) = >100 then... but how do i set the threshold of 120?

Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 6th, 2012, 3:27 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
There are called logical operators:

http://www.w3schools.com/js/js_comparisons.asp

Code:
if (a >=100 && a<=120)
{
Debug.trace("hello")
}


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 6th, 2012, 3:33 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Thanks, this helps me further... i hope


Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Last edited by Ad Mulders on January 7th, 2012, 9:41 am, edited 1 time in total.

Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 7th, 2012, 9:40 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Oops... my knowledge of scripting is still my weak pont.
I tried it, and i was also be able to show a picture as a result,
but how do i add 1 point to a sertain variable each time the input on (a) is between 100 and 120?

The question is... how do i set up the output to a variable.


Ad
:oops:

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 7th, 2012, 11:24 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Not sure if this is what you're asking, but:

Code:
if (a >=100 && a<=120)
{
b=b+1
}


This takes the value in the second 'b', adds one to the value and then assigns it to the first 'b'.

For purists, it's possible to simplify this:

Code:
if (a >=100 && a<=120)
{
b++
}


While it's useful to remember the second method, it's important to remember that a single equals (=) is used to assign a value on the right to a value on the left.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 7th, 2012, 2:42 pm 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Great man, thanks!!


Ad

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 8th, 2012, 11:18 am 
Offline

Joined: May 16th, 2008, 4:50 pm
Posts: 368
Location: Berghem The Netherlands
Opus: Opus Pro 9.75
OS: Windows 10
System: `HP
Something strange is going on... or is there an explanation

When i use this, it works fine:
if (ENTER1 >=49 && ENTER1<=99)
{
STATS_100_1++
}


I want the user to choose which value it is used so i made some input variables.
If i change it to this it's very inaccurate and it looks like he works better with numbers greater then 100
but maybe it's coincidence.

if (ENTER1 >=(STATS_SET1_LO) && ENTER1<=(STATS_SET1_HI))
{
STATS_100_1++
}

Am i doing something wrong? :roll:

_________________
Opus Pro v9.75
Windows 10 on HP EliteBook i7
http://www.csnmedia.nl


For this message Ad Mulders has been thanked by : mackavi


Top
 Profile Visit website  
 
 Post subject: Re: if then question
PostPosted: January 8th, 2012, 1:38 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Don't need the extra brackets, but it'll still work fine with them. Try adding some debugs to check the values going into the IF statement.

Code:
ENTER1=100
STATS_SET1_LO=49
STATS_SET1_HI=99
STATS_100_1=0

if (ENTER1 >=STATS_SET1_LO && ENTER1<=STATS_SET1_HI)
{
STATS_100_1++
}

Debug.trace(STATS_100_1)


Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 40 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group