Skip to main content
Participating Frequently
August 29, 2015
Question

Captivate 6 advanced actions - a counter to know how many variables are not empty

  • August 29, 2015
  • 1 reply
  • 682 views

I want to know how I can use an Advanced action to build a sort of "counter".

I have 10 "text entry boxes" allowing me to enter up to 10 participants names and I want Captivate to count, after having entered several names, the number of participants.

So, I already have 10 variables for the potential 10 participants + another variable called NumberPart (that should display the number of participants, after it has been use in the advanced action.

The 10 "participants" variables are empty when the project is launched.

The variable NumbPart value is initialize with 0 (zero) when we start.

I tried a conditional advanced action going like this :

Block Decision 1

If Part1 is not equal to 0  (I also tried: "" ; " "; TRUE ; FALSE)

     then

Assign NumbPart with 1

Block Decision 2

If Part2 is not equal to 0

     then

Assign NumbPart with 2

and so on...

This advanced action doesn't seem to work, mt NumbPart variable is always empty...

Any idea?

Thanks to everyone who can help me!

Jean Laurier

This topic has been closed for replies.

1 reply

JLaurierAuthor
Participating Frequently
August 29, 2015

Hope that nobody has spent time on this one, I have found why it didn't work.

I must use simple quotes instead of double quotes to specify an empty text string...

Block Decision 1

If Part1 is not equal to ''

     then

Assign NumbPart with 1

Block Decision 2

If Part2 is not equal to ''

     then

Assign NumbPart with 2

and so on...

If this could help someone else, I would be glad!

Have a nice week-end!

Jean Laurier

RodWard
Community Expert
Community Expert
August 29, 2015

For what it's worth, I think you're going about this the wrong way.

Your current approach will only work if the order that people are entered into the Part# variables never changes.  If that should for any reason vary, then your NumbPart variable will not number correctly.

I suggest you look at using either the Increment action to add 1 to the NumbPart variable after each new user is added, or else use the Expression action which takes whatever the current value of NumbPart is as a starting point and then adds to that.  Either one would do.

Lilybiri
Legend
August 30, 2015

Just another question and tip: are those quotes functional, really? They never worked for me, because Captivate doesn't recognize an empty string. Long time ago I wrote about the approach using a user variable that is empty. That will always work:

Where is Null? - Captivate blog

From the number of views for that article, even today, I suspect this is still the best way to test for a TEB to remain empty.

The logic of your conditional action is also not fool proof as Rod points out. You could disable the TEB once it ihas an entry to avoid that and use the increment counter approach. With your present setup, if the first and the third TEB gets a name, you'll have a counter of 3 instead of 2.