Check if any element in selection group is selected

I have a text field that I want to set the text for when three different selection groups inside three repeaters each have a widget selected.

Is there a way to add a conditional on a selection group?

Not that I’m aware of. I would probably create a single handler to handle a change to the selections and call it from any selection change event on any member of the group. The handler would then need to perform the logic.

If you mean set the text if ANY one item is selected from EACH group, then an increment/decrement of a counter variable could be used to keep track of how many selections have been made.

The second scenario is what I’m trying to achieve.
If you were to use a counter variable, how would you decrement the counter? By selecting a widget all the other widgets in the selection group are deselected automatically, what would trigger the decrement?

You are right! That’s what I get for sending off a quick reply. A counter won’t work because for each selection event a counter won’t tell you if you’ve already counted a selection event for the same group.

So, as penance, I made the attached. Each group has a ‘flag’ element that keeps track if a selection has been made for that group. Each time a group becomes selected, logic is run to see if ALL 3 groups are selected, and to change the heading if so.

1911 Track selections.rp (88.4 KB)

D’oh. Actually a counter will work, because you can decrement it on ‘unselected’ events. So selecting an item from a group which already has a selection both increments and decrements the count. See page 1.

1911 Track selections.rp (92.2 KB)

This was just what I wanted, thanks!

One final question, so I tried to put the fire event in a ‘selected or unselected’ event and the increment in the ‘selected’ event but it didn’t seem to work. Even though the fire event was logged after the increment in the trace logs, the counter conditional wasn’t evaluating to true until I explicitly put the fire event action after the increment in the ‘selected’ event. Is the only way to ensure the order of operations by putting the actions in the correct sequence inside one interaction?

All I can say is I sympathise.
Axure routinely confuses me about timing. As you say, things don’t always seem to fire in the order you expect. This may be because ‘routines’ are actually being run in javascript, possibly asynchronously, and the console is not really directly reflecting when things are executed? But I’m no coder…
Yes, placing everything in sequence in the one ‘routine’ is one way to defend against this. I also find I have to sprinkle ‘wait’ statements through the code occasionally to give everything a chance to settle down.
A ‘proper’ debugger would probably be overkill for Axure and possibly bad for its market positioning, but I often wish it came with a ‘proper’ debugger… (and I’m no coder!)

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