Selecting with condition

Hi all! how is your weekend?
I have 10 or more dynamic panels. the rule is to select no more then 5 elements.
when selecting 5 elements, i need it to show the “good message”
and when selecting more then 5, i need to show the “bad message”.
i’m very bad with conditions. i really need your help!

if you have good tutorials for my better understanding of conditions and variables in Axure, i’ll be more then happy.

tnx agina

AMIRchoosing.rp (84.0 KB)

1 Like

Here is one way to do it:
choosing.rp (96.4 KB)

There needs to be some way to keep track of how many panels have been selected, so I just used the default global variable, OnLoadVariable. Each time that a panel is set to selected (a change to State2) it increases the value of OnLoadVariable by 1 and each time it is deselected (a change to State1) it decrements OnLoadVariable by 1. Now we can tell at any time how many panels are selected.

We also need to test the value of OnLoadVariable whenever a panel is clicked. If it is the fifth panel, show “Good Message” and if there are more than 5, show “Error Message”. (Presumably hide both messages if less than 5 selected.) So, I could have added a few conditions to panel “1” and then copied them to all the other panels, but if the rules need to change or just get debugged, then I would have 10 changes to deal with. So, I decided to implement the conditional tests only once. I could have created a hidden button or widget and fired its OnClick, or used another blank dynamic panel, etc., but instead I made use of the existing widgets. When each panel is clicked it sets its state to Next-Wrap and then it rotates the “Good Message” widget by 0-degrees to trigger the OnRotate event:

image

When “Good Message” is rotated, it handles the count of selected panels to show the correct message:

image

Here is the Axure reference page for Conditional Logic:
https://www.axure.com/support/reference/conditional-logic

You can also work through the Core Training and Tutorial modules to learn the basics. Well worth the time in my opinion.
https://www.axure.com/support/training/core/1-basics

i did it.
tnx

choosing (1).rp (98.4 KB)

Hi @amirtzadok ,

I may be late for this! But one thing I have learnt in my experience is, you do not always need to use global variables for our operations on a single page.

Better to go for a listener like a hidden text box. You can use setText method to play with values when selected.
Eg. setText to [[textValue+1]]

Just a suggestion! Have a good week :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.