cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3638
Views
7
Helpful
7
Replies

Position in the queue-UCCX Script

pmd4332
Level 1
Level 1

What if you wanted to bypass telling the call their position in queue if their position has not changed? I want to make it so the callers does not have to hear their position over and over if it has not changed. Can someone show me how to accomplish this?

2 Accepted Solutions

Accepted Solutions

Chris Deren
Hall of Fame
Hall of Fame

You could simply use another variable that stores the value of the position and then on next queue loop have an IF statement that checks if the new position in queue variable is equal to previous value, if yes skip the announcement, if not play it.  You then again copy the new position in queue variable value as the "previous" variable.

View solution in original post

Here's an example, based on pseudo code (un-tested).  If I can get to testing the code out I will, but for now, I hope this guides you in the right direction.  It's more the concept that is important, versus how I did it.  I.e., Validation checks, and storing previous bests.

 

 

current_position = Get Reporting Statistics (Position In Queue)

/* Validation Check for Positive Values */
If (current_position > 0)
  True
    /* Did we improve our position from our previous best? */
    If (current_position < previous_best)
      True
        /* Yes we did, so store the current position as our new previous best, and play current position */
        Set previous_best = current_position
Play Prompt (p[youarethe] + #[current_position] + p[callerinline])
False
/* No we did not, so keep previous best the same, and play previous best */
Play Prompt (p[youarethe] + #[previous_best] + p[callerinline])

 

 

 

View solution in original post

7 Replies 7

Chris Deren
Hall of Fame
Hall of Fame

You could simply use another variable that stores the value of the position and then on next queue loop have an IF statement that checks if the new position in queue variable is equal to previous value, if yes skip the announcement, if not play it.  You then again copy the new position in queue variable value as the "previous" variable.

Don't forget to handle when the current position comes back as -1, which can happen, if the stat cannot be obtained in that moment. In which case, you'd play -1, because it's lower than the previous position.

 

Also, if you do receive a -1, don't store it as the previous either, because then if in the next loop you are in PIQ 4 from an original position of 5, then you will play -1 which is held in previous, because current is worse than previous.

 

And lastly, don't forget to ignore previous on the first time through, cause it will be 0, and 0 is better than any positive PIQ.  I supposed you could artificially start previous off really high, like 99 or something.

 

Actually here's a little table to show a bad case scenario could be without proper handling of variables:

 

Loop # What Happens? Curr Prev Is Curr Better? Then Play... Caller Hears
1* Initial Entry 4 0 No Prev 0
2 Moved Fwd 1 3 4 Yes Curr 3
3** PIQ Error -1 3 Yes Curr -1
4 Moved Fwd 1 2 -1 No Prev -1
5 Stayed Same 2 2 Same Curr 2
6 Moved Back 2 4 2 No Prev 2
7*** Moved Fwd 1 3 4 Yes Curr 3
8 Moved Fwd 2 1 2 Yes Curr 1

 

*Note that initially the prev will be better than curr, so account for that

**Note that sometimes a -1 can come back, so account for that

***Note that just looking at the immediate prev value, you could actually play a higher PIQ, so account for that

So does this type of solution actually work? there appears to be a few "gotchas" in it. How do I prevent getting the -1?

I have included a couple of pics.PIQ Bypass variables.PNG

 

PIQ Bypass.PNG

 

 

 

Yes, it's solvable, it's just not as straight forward as one might think. Also, I don't see you storing the current value into the previous value, in this screenshot.

I would just say, do some checking of the data you get back from the Get Reporting Statistics step first, before you play the prompts or store the values. Something like: If (curr > 0) would ensure that only positive values come out of the step, and then only store the curr in prev if the this will improve the prev. E.g., In step 7 of my table, I shouldn't have stored 4 as the prev, because it's worse than the previous prev value of 2. It's best to treat this not like straight previous value, but instead, the previous best value.

Can you clarify how to save to current storage? Can I just add another variable such as “stat_CurrentPIQ”and place it in “Get Reporting Statistic”

Here's an example, based on pseudo code (un-tested).  If I can get to testing the code out I will, but for now, I hope this guides you in the right direction.  It's more the concept that is important, versus how I did it.  I.e., Validation checks, and storing previous bests.

 

 

current_position = Get Reporting Statistics (Position In Queue)

/* Validation Check for Positive Values */
If (current_position > 0)
  True
    /* Did we improve our position from our previous best? */
    If (current_position < previous_best)
      True
        /* Yes we did, so store the current position as our new previous best, and play current position */
        Set previous_best = current_position
Play Prompt (p[youarethe] + #[current_position] + p[callerinline])
False
/* No we did not, so keep previous best the same, and play previous best */
Play Prompt (p[youarethe] + #[previous_best] + p[callerinline])

 

 

 

Thanks, Anthony, this was very helpful in helping me understand the logic. I was able to get the desire result using this.