Update a text field to reflect the number of dynamic panels to go

I am building a task flow using dynamic panels and want to summarise where the user is and how many steps are left using the following text:

Task section 1 of 7

Where ‘1’ is the number of the current panel in the order and ‘7’ is the total number of panels.

I want to use onPageLoad or onPanelStateChange but I’m not sure how to implement the count. Is anyone able to advise me?

Create a global variable. I’m going to call it CurrentPanel. Give it a default value of 1. I’m going to assume you named your text field “Status” (swap this for whatever you called it). Then create the following cases/actions:

Set text of Status to: Task section [[CurrentPanel]] of 7.

Set text of Status to: Task section [[CurrentPanel]] of 7.

Now on any event that advances the users through the states (a click, a keypress, whatever), make sure you add this action:
Set value of CurrentPanel: [[CurrentPanel + 1]]

And on any event that takes the user back in the panel states (maybe you have a back button?), make sure you add this action:
Set value of CurrentPanel: [[CurrentPanel - 1]]

Thanks a lot for the suggestion but I can’t seem to make it work. My “Status” it outside of the panel but I don’t think that should really make a difference?

That shouldn’t matter, something else must be going on.

Here’s what I’ve got:

This is at the page level:

This is on the dynamic panel:

And this one is on the button which navigates forwards:

Do you have any thoughts? Although you can’t see the entire text I have entered it exactly as you’ve suggested. Much appreciated!

You’ve got conditions on your cases. It’s not clear why you have those conditions but they might be interfering. For example, your OnPanelStateChange case will only ever happen when changing to a state called “Further considerations” but not for any of the other states. Presumably you want this to occur for every state change, so remove the condition. If you need that condition for something else then you need to separate the cases.

If state of This equals Further considerations <-- Only happens for that panel state
//Do something
If true <— happens for all panel states
Set text on task progress label…

That’s brilliant - thank you! I just got that working and am very grateful for your help. There’s one more thing - how would I get the text to display the total number of panels?

Since you can’t add panel states dynamically through user interaction, you’ll have to just hard code it. If you want to only have to make that change in one place, add a global variable to store that number and then just use that variable in any Set Text actions.