Decision Question

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Decision Question

Post by acestu »

Hi,

I am trying to determine the condition of ten variables in 1 decision but I don't think I am wording it correctly, I am using:



If
(Timer1Status = 0) && (Timer2Status = 0) && (Timer3Status = 0) && (Timer4Status = 0) && (Timer5Status = 0) && (Timer6Status = 0) && (Timer7Status = 0) && (Timer8Status = 0) && (Timer9Status = 0) && (Timer10Status = 0)

And basically what I am trying to say is,

Is the value of all these variables 0 ?


Is this the correct way to write this ?

thanks
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

Re: Decision Question

Post by cobra1 »

That looks good to me :)

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Decision Question

Post by medelec35 »

That also looks good to me.

If you want to simplify your flowchart and use less icons you could considered using a a 10 element array instead of 10 individual variables.
I did an example of this within a Flowchart that can be found here:
http://www.matrixmultimedia.com/mmforum ... 413#p53464

You will be able to see using the array method enabled my to set up 255 different pass codes without having a load of different massive decision icons

Martin
Martin

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Decision Question

Post by acestu »

Hi Cobra,

Thanks for confirming this, I guess my problem lies elsewhere.....

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 783 times
Been thanked: 223 times
Contact:

Re: Decision Question

Post by acestu »

Hi Martin,

This problem is to do with the Interrupt and Boost issue that you helped me with last week, I think I am going to have to post the chart for you to look at...

cheers
Acestu
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

Brendan
Posts: 243
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 140 times
Been thanked: 118 times
Contact:

Re: Decision Question

Post by Brendan »

Hi Acestu.

I'm sure I'm missing the point (apologies in advance) but if specifically to check all values were zero then you could simply add all vars together and check for zero in the result.


All the best,

Brendan

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Decision Question

Post by medelec35 »

Hi Brendan,
that's a good idea if the result is stored in an 16 bit int.
When the question was fist asked it was unknown want the value of variables were.
So if all variables were bytes you add the bytes when say Timer1Status = 1,Timer2Status = 255,Timer3Status = 0,Timer4Status = 0,Timer5Status = 0, Timer6Status = 0, (Timer7Status = 0, Timer8Status = 0, Timer9Status = 0, Timer10Status =0
and result was stored in a byte then result would be 0

So it would work so long as int and not byte is used.

I thought I would mention that in case Stu tries with a byte to store result.

In reality if each variable was either 0 or 255, then that would work with a result stored in byte or Int.


Martin
Martin

User avatar
JonnyW
Posts: 1230
Joined: Fri Oct 29, 2010 9:13 am
Location: Matrix Multimedia Ltd
Has thanked: 63 times
Been thanked: 290 times
Contact:

Re: Decision Question

Post by JonnyW »

Hi.

It would work if you orr the variables together: (A | B | C...) == 0

Upside is it is compact and produces less code. Downside is it is slower if the first value is zero (in which case && will not check any following values).

Cheers,

Jonny

Post Reply