cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
54
Views
0
Helpful
0
Comments
cdnadmin
Community Member
This document was generated from CDN thread

Created by: null on 21-11-2003 06:13:11 AM
Hi All, i need to be able to be able to use information stored inside Session data as a STRING element, or element name.

For example
Session data "CurrentManu" set to audium form name "A_Menu"
inside XML decision block under data tag
<exit_state name="1" conjugate="and">
<string operator="equal">
<data>
<element name={Data.Session.CurrentMenu} variable="value"/>
</data>
<constant_string value="1"/>
</string>
</exit_state>

Currently when I do this I get the error "A_Menu, element, error, the rule file could not be loaded: value must be quoted." as it cannot see Session data as a string.

Is there any solution to this? I need to be able to pass string elements in Session data!

Cheers

Bernard

Subject: RE: Passing Session data as a STRING element
Replied by: null on 21-11-2003 04:32:34 PM
Hi,

You can refer to session data in XML decisions by using the <session> tag. For example:

[code:1:cb3775df8f]
<exit_state name="1" conjugate="and">
<string operator="equal">
<data>
<session name="CurrentMenu"/>
</data>
<constant_string value="1"/>
</string>
</exit_state>
[/code:1:cb3775df8f]

Hope this helps!

Subject: RE: Passing Session data as a STRING element
Replied by: null on 24-11-2003 02:38:50 AM
Hi Elam,

Unfortunatley that doesn't help all that much. I guess I should have explained more, as the Session varible CurrentMenu actually points to an Form question element, and I was hoping of being able to use that to be able to access variables that have been populated in that Form element.

The idea is to be able to access the results of (DTMF/Speech) processing, and make a decision by referencing a Session data as opposed to an Element data. How can I do? Currently if I try to populate a Session variable with data from a form (called "Test_Menu") by using the Session data input {Data.Element.Test_Menu.result}, I literally get that string instead of the result.

Hope you can help!

Cheers

Bernard

Subject: RE: Passing Session data as a STRING element
Replied by: null on 24-11-2003 06:55:17 PM
Hi Bernard,

Ok, it looks like you want to access session data in a decision which holds the name of an element, and then obtain element data of that element. So you have two Form elements, say, both leading to a decision and you want to obtain the element data (value, say) in that decision. You don't know which Form element the caller visited, so you store the name of the element visited in Session Data with the expectation of being able to use the element name stored within to get the information you need.

As I explained previously, you cannot use substitution strings in XML decisions, the substitution string you mentioned above can only be used in the Audium Builder in element settings.

There are, however, alternatives in both the XML decision format as well as the Java or XML-over-HTTP API.

XML Decisions

-----

Using the XML decision format, you can take the following approach: Look to see if the caller visited the appropriate element and use the "and/or" operators to then do the appropriate check. I will give an example. You have two forms, FormA and FormB and you want to make a decision based on whether the confidence level of either form is greater than 50% (but you want to check the form visited by the caller). Here is an example:

[code:1:c524825c91]
<rule name="theRule" default_exit_state="less_than_50">
<exit_state name="greater_than_50" conjugate="and">
<boolean check_existence="yes" value="true">
<data>
<element name="FormA" variable="value_confidence"/>
</data>
</boolean>
<number operator="greater_equal">
<data>
<element name="FormA" variable="value_confidence"/>
</data>
<constant_number value="0.50"/>
</string>
</exit_state>
<exit_state name="greater_than_50" conjugate="and">
<boolean check_existence="yes" value="true">
<data>
<element name="FormB" variable="value_confidence"/>
</data>
</boolean>
<number operator="greater_equal">
<data>
<element name="FormB" variable="value_confidence"/>
</data>
<constant_number value="0.50"/>
</string>
</exit_state>
</rule>
[/code:1:c524825c91]

So in this example, we return the exit state "greater_than_50" when:
(a) The element data named "value_confidence" from the element "FormA" exists AND that value is greater than or equal to 0.50.
(b) The element data named "value_confidence" from the element "FormB" exists AND that value is greater than or equal to 0.50.
In all other situations the exit state "less_than_50" is returned. This can easily be changed to return more exit states if you wnt to look at the value in more detail.

So here we use the <boolean> tag to check to see if some variable exists. It will not exist if the caller visited the other Form, so we will be able to take the confidence value from the appropriate form element.

In this approach, there is no need for you to create the Session Data "CurrentMenu".

Java or XML-over-HTTP API

-----

Using this API, you can do something in the spirit you originally proposed. Simply obtain the value of the "CurrentMenu" Session Data, then use that value to get the element data from that element. So if you have two forms, FormA and FormB and want to get the confidence value from the appropriate Form in a decision element you write in Java, you can do the following:

[code:1:c524825c91]
String whichForm = elementAPI.getSessionData&#40;"CurrentMenu"&#41;;
String confidence = elementAPI.getElementData&#40;whichForm, "value_confidence"&#41;;
[/code:1:c524825c91]

Another way you could do this without having to use any Session Data is to look at the element history and evaluate the name of the element that appeared right before the decision element

[code:1:c524825c91]
ReadOnlyList elementHistory = elementAPI.getElementHistory&#40;&#41;;
String lastElement = elementHistory.lastElement&#40;&#41;;
String confidence = elementAPI.getElementData&#40;lastElement, "value_confidence"&#41;;
[/code:1:c524825c91]

I believe you can use lastElement(), though I am not sure if that will return the name of the decision element. If it does, you can eaily look at the element previous to that one.

Hope this helps!
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Quick Links