01-21-2019 01:01 PM - edited 03-14-2019 06:44 PM
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?
Solved! Go to Solution.
01-22-2019 05:50 AM
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.
01-24-2019 02:01 PM - edited 01-28-2019 07:35 AM
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])
01-22-2019 05:50 AM
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.
01-22-2019 04:11 PM - edited 01-22-2019 07:00 PM
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
01-23-2019 04:34 PM
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.
01-24-2019 08:18 AM
01-24-2019 12:02 PM
01-24-2019 02:01 PM - edited 01-28-2019 07:35 AM
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])
01-27-2019 11:47 AM
Thanks, Anthony, this was very helpful in helping me understand the logic. I was able to get the desire result using this.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide