Decision Question

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

Moderator: Benj

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

Decision Question

Postby acestu » Sat Nov 30, 2013 8:14 pm

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

Postby cobra1 » Sat Nov 30, 2013 8:45 pm

That looks good to me :)
These users thanked the author cobra1 for the post:
acestu (Sat Nov 30, 2013 9:30 pm)
Rating: 5%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8615
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2480 times
Been thanked: 3564 times
Contact:

Re: Decision Question

Postby medelec35 » Sat Nov 30, 2013 9:26 pm

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:
viewtopic.php?f=26&t=7413#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
These users thanked the author medelec35 for the post:
acestu (Sat Nov 30, 2013 9:33 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: Decision Question

Postby acestu » Sat Nov 30, 2013 9:29 pm

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: 787 times
Been thanked: 226 times
Contact:

Re: Decision Question

Postby acestu » Sat Nov 30, 2013 9:32 pm

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: 223
Joined: Tue Nov 27, 2012 12:53 pm
Location: Cambridge, UK
Has thanked: 136 times
Been thanked: 115 times
Contact:

Re: Decision Question

Postby Brendan » Sun Dec 01, 2013 11:52 pm

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
These users thanked the author Brendan for the post:
medelec35 (Mon Dec 02, 2013 4:06 pm)
Rating: 5%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8615
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2480 times
Been thanked: 3564 times
Contact:

Re: Decision Question

Postby medelec35 » Mon Dec 02, 2013 8:59 am

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
These users thanked the author medelec35 for the post:
Brendan (Mon Dec 02, 2013 3:39 pm)
Rating: 5%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

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

Re: Decision Question

Postby JonnyW » Mon Dec 02, 2013 9:55 am

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
These users thanked the author JonnyW for the post (total 2):
medelec35 (Mon Dec 02, 2013 2:16 pm) • Brendan (Mon Dec 02, 2013 3:40 pm)
Rating: 10%