Play Prompt by use of string variables

Answered Question
Mar 8th, 2010

Hi,

Im writing a script and i hope to reuse most of the logic from it for other very simmilar scripts.

Regarding the prompts, i have made a prompt directory which categorises the prompt names (which are a numeric value) to keep it structured. Hopefully this will explain better.

Prompts are reccored and stored in xx=team ID yy=prompt categry and zz=prompt

e.g. 060110.wav = team 06, prompt category = 01 (welcome) and prompt = 10 (

To play the welcome message i have;

variable; (all string)

teamID - e.g "06"

pWelcomeMessage - e.g. "0110.wav"

play prompt = teamID + pWelcomeMessage

This allows me to set the teamID as a parameter and use the same script over again. This piece is working perfect....

In the queuing section i have to play the position in the queue. Initially i had the system play the position number from a get reporting statistic which worked but they want to record the position prompt themselves. so, If the PIQ <= 5 there is a SET step to;

set pPositionInQueue = "teamID + positionPromptCategory + positionInQueueString + positionPromptExtn"

I was hoping this would work, i converted the PIQ integer to a string to see if that fixed it but no luck. So for caller who is position 2 in the queue the prompt file should be (with no spaces) 06 021 2 .wav.

Any ideas on where im going wrong? I think i need to use a generate prompt step but im not sure....

Best wishes

Jon

I have this problem too.
0 votes
Correct Answer by Tanner Ezell about 6 years 9 months ago

Hmm, I'm not sure why my email response never made it to the thread but alas, the original message:

set pPositionInQueue = teamID +""+ positionPromptCategory +""+
positionInQueueString +""+ positionPromptExtn

That will result in a string.

You must have + "" in there otherwise, when you add two strings
together that contain a number it gets added. Putting in "" prevents
this.

From my understanding thats what you are trying to accomplish

You want the result of say, "061001.wav" from strings teamID "06" and pSomethingElse "1001.wav"

Correct Answer by Anthony Holloway about 6 years 9 months ago

Playing two user defined prompts in one Play Prompt step:

Play Prompt (--Triggering Contact--, P[var1 + var2] + P[var3 + var4])
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (2 ratings)
Loading.
Anthony Holloway Mon, 03/08/2010 - 09:03

You are close.  You will need to pad your PIQ for values less than 10.

Play Prompt (--Triggering Contact--, teamID + positionPromptCategory + ((positionInQueue < 10) ? "0": "") + positionInQueue + positionPromptExtn)
gbljoba Mon, 03/08/2010 - 09:10

Thanks for the quick reply Anthony!

Why do i need to pad out the PIQ string? the PIQ value should be the last digit before the file extension e.g 060212.wav. I know i said the category was only two digits but as i play a different prompt for PIQ > 5 then i can set the first prompt digit in the category digits.

Cheers

Jon

gbljoba Mon, 03/08/2010 - 09:37

Ive got round the problem slightly by not setting the variable pPositionInQueue. It worked when i had specified "teamID + positionPromptCategory + positionInQueueString + positionPromptExtn" as the prompt for the menu step instead of the pPositionInQueue variable. the only problem now is that in need to play a prompt before this with a filename of "teamID + pQueueSeccond" which are again all variables. So in theror it looks like;

prompt = "teamID + pQueueSecond" + "teamID + positionPromptCategory + positionInQueueString + positionPromptExtn"

I think im going to have to have a container prompt to achieve this unless anyone knows some syntax.

/Jon

Correct Answer
Anthony Holloway Mon, 03/08/2010 - 11:44

Playing two user defined prompts in one Play Prompt step:

Play Prompt (--Triggering Contact--, P[var1 + var2] + P[var3 + var4])
Correct Answer
Tanner Ezell Mon, 03/08/2010 - 11:59

Hmm, I'm not sure why my email response never made it to the thread but alas, the original message:

set pPositionInQueue = teamID +""+ positionPromptCategory +""+
positionInQueueString +""+ positionPromptExtn

That will result in a string.

You must have + "" in there otherwise, when you add two strings
together that contain a number it gets added. Putting in "" prevents
this.

From my understanding thats what you are trying to accomplish

You want the result of say, "061001.wav" from strings teamID "06" and pSomethingElse "1001.wav"

Anthony Holloway Mon, 03/08/2010 - 14:13

To clarify what Tanner is saying.

A String plus an Integer, equals a String.  In programming, this is called type casting.

Thus:

int a = 1

int b = 2

String s = a + b

s == "3"

Whereas:

int a = 1

int b = 2

String s = "" + a + b

s == "12"

Message was edited by: Anthony Holloway - To be technically correct, only the Editor lets you type cast so easily as I did in the first example.  Java would not have let you done that, and only worked with the second example.

gbljoba Wed, 03/10/2010 - 10:53

Thanks guys that worked a treat. Have some magic stars!

Actions

This Discussion