Showing 6 results.
Items per Page 50
of 1

CVP Forum

« Back to General Discussion - All Versions

Prompting the values of an array using element data

Combination View Flat View Tree View
Threads [ Previous | Next ]
I am collecting array kind of data from database. however i don't konw how much the size of that array will be. For example it can be either 2 or 20 etc. As soon as i read it from CRM side i put them to element datas in Java side(action elelement) namely as Fund1, Fund2 ..... FundN.
I need to play these values to the customer one buy one. As I know the size i also write it to another element data as well.
On studio i created a loop kind of mechanism. But when it comes to playing the values i can not find a proper expresion for that. {Data.Element.GetFundPrice_01.Fund1}
{Data.Element.GetFundPrice_01.Fund2}
........
{Data.Element.GetFundPrice_01.Fundn}
I was trying to make that Fund*X* a counter. I think an expression in an expression is not allowed. Like:
{Data.Element.GetFundPrice_01.Fund{Data.Element.Counter_01.count}}

You're right, Studio won't let you use a variable inside the name of a
variable, but you can do it within the Java.

So, you should probably write a Java element (or standard action) that
stores the name of the audio to play (stores the contents of
{Data.Element.GetFundPrice_01.Fund#}) into a new element or session data
variable (here, I've called it 'SpeakThis').

Then in the Studio app, speak out the new variable
{Data.Element.ActionElementName.SpeakThis}

Java code, where 'data' is the Session API passed to the doAction() method:

String ctr=data.GetElementData("Counter_01","count");
String audioToSpeak = data.GetElementData("GetFundPrice_01", "Fund"+ctr);
data.setElementData("SpeakThis",audioToSpeak);
//Or you could store this into Session variable and select it in Studio as {Data.Session.SpeakThis}
//data.setSessionData("SpeakThis",audioToSpeak);


Regards, Janine
www.TrainingTheExperts.com