03-16-2020 09:20 AM
Hello,
Can someone provide me an example on how to build a dynamic menu.
I need to list items in an array in a menu. The file name is the value of the string in the array.
For example the menu should say as following. I am new to UCCX and not sure where this logic go in.
Array[0].wav press 1
Array[1].wav press 2
Array[3]wav press 3
For more items press 9
Thanks in advance.
Solved! Go to Solution.
03-16-2020 12:15 PM - edited 03-16-2020 12:25 PM
Yes, you'd use the Do step right before hand, however, you could technically place it in the Menu step (shown below).
Is the "For", "Press" and number (E.g., "one" "two" "three") supposed to be system generated or will you have those recorded as separate wav files?
Also, the .wav file extension is optional, so if it's not in the String array (E.g., String[] {"Sales"} VS String[] {"Sales.wav"}) then it's not a problem.
If you were system generating the for, press and the number, then you could change the Do step to this to insert them:
{ int i = 0; int j = my_array.length; for (; i < j; i++) { result += sp[UserDialog\for] + p[my_array[i]] + sp[UserDialog\press] + n[i + 1]; } }
The n[] tells the system to say a number (like "Four" or "One Hundred").
The sp[] is a system prompt, and plays the correspond wav file. There's no easy way to see which system prompts are available, but if you have the UCCX ISO, you can drill into the following folder to see them all (using 12.5 as an example):
UCSInstall_UCCX_12_5_1_UCOS_12.5.1.10000-31.sgn.iso\Cisco\contactcenterexpress\RPMS\UCCX07_Prompts-8.0.1-1.i386.rpm\UCCX07_Prompts-8.0.1-1.i386.cpio\.\common\cisco\uccx\Prompts\system\G711_ULAW\g711.tgz\g711.tar\en_US\
I don't really recommend doing it in here, because it makes the script look ugly, but you could do this right in the menu step like this:
03-16-2020 10:18 AM
Welcome to the world of UCCX! Two questions for you:
Even before you answer, I can still share a solution on converting a String array into a concatenated prompt variable.
However, before we get straight into the answer, let's look at a few building blocks first.
UCCX does something called type casting for us, sepcifically with the Set step. So, if we had a filename in a String, we could cast that to a Prompt like so:
Set my_prompt = "filename.wav" /* my_prompt is now P[filename.wav] */
Also, it acts the same whether you enter a String literal or used a variable there.
We don't always have to type cast first before using it, because some steps can actually handle different types of input. You can see this pretty easily with the mouse over tool tip on the input fields like so:
Therefore, if I was using a single String variable to hold my filename, I could actually just pass it to the menu step without the need for a cast:
Again, this works with Sting variables as well as literals.
Unfortunately, you cannot just put a String array in there and hope for the cast to happen....that would be nice.
We could write some code to convert each of the elements to a prompt and concatenate them for us, but there's actually a built in step for that.
The Create Container Prompt step is used to build the Prompt concatenation for you, however, it would be a fixed size all the time. So, if you could guarantee that your Array will never be a different size, then this might be the option for you:
If you did need a solution which could handle String arrays of varying sizes then we could turn to this small bit of code in a Do step:
{ int i = 0; int j = my_array.length; for (; i < j; i++) { result += p[my_array[i]]; } }
This assumes that your String array is called my_array and the resulting prompt variable you'll play with the menu step is called result.
I hope that helps you out.
PS There are some really detailed notes on the Expression Language over on developer.cisco.com
03-16-2020 11:40 AM
Hello @Anthony Holloway ,
Thanks for your response.
1. No the wave file does not contain the full instruction. My plan is to pay 'For' as prompt before the menu ('for' needs to be played only at the beginning of the listing).
press1, press2, press 3.... these are separate recordings.
Sales, Marketing, HR,... these are the only values in the array so when playing it, the script needs to add .wav to too.
2. Yes the press option needs to dynamically change too. I was thinking while looping through the array, if the index is 0, set the prompt to play press1, if index is 1, set the prompt to play press 2.....
The array is a not a fixed length.
so if I am using a do Step to build the prompt path, and then I use a Menu step right after it? Basically the do step builds the full phrase for the Menu?
03-16-2020 12:15 PM - edited 03-16-2020 12:25 PM
Yes, you'd use the Do step right before hand, however, you could technically place it in the Menu step (shown below).
Is the "For", "Press" and number (E.g., "one" "two" "three") supposed to be system generated or will you have those recorded as separate wav files?
Also, the .wav file extension is optional, so if it's not in the String array (E.g., String[] {"Sales"} VS String[] {"Sales.wav"}) then it's not a problem.
If you were system generating the for, press and the number, then you could change the Do step to this to insert them:
{ int i = 0; int j = my_array.length; for (; i < j; i++) { result += sp[UserDialog\for] + p[my_array[i]] + sp[UserDialog\press] + n[i + 1]; } }
The n[] tells the system to say a number (like "Four" or "One Hundred").
The sp[] is a system prompt, and plays the correspond wav file. There's no easy way to see which system prompts are available, but if you have the UCCX ISO, you can drill into the following folder to see them all (using 12.5 as an example):
UCSInstall_UCCX_12_5_1_UCOS_12.5.1.10000-31.sgn.iso\Cisco\contactcenterexpress\RPMS\UCCX07_Prompts-8.0.1-1.i386.rpm\UCCX07_Prompts-8.0.1-1.i386.cpio\.\common\cisco\uccx\Prompts\system\G711_ULAW\g711.tgz\g711.tar\en_US\
I don't really recommend doing it in here, because it makes the script look ugly, but you could do this right in the menu step like this:
03-16-2020 01:07 PM
It worked beautifuly! Thanks @Anthony Holloway
03-16-2020 01:14 PM
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