Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
Created by: null on 20-09-2007 11:04:43 PM Within a custom element, I am attempting to have nested "if" tags. There doesn't seem to be a way to add a VIfGroup to another VIfGroup. Is there some other way of accomplishing this? I also tried to add the VIfGroup to the VAction of the first VIfGroup's action attribute with no luck.
Subject: RE: Nested Ifs Replied by: Vance Vagell on 20-09-2007 11:20:37 PM Hi Joel,
In VoiceXML 2.0 there is no concept of nested if-statements. However, you can add elseif tags to an if-statement by calling:
additional times against the VIfGroup. See the Javadocs for VIfGroup.add() for details.
Regards, Vance
Subject: RE: Nested Ifs Replied by: null on 21-09-2007 03:10:12 PM VoiceXML supports if-statements within another if-statement. I've done it in plain VXML before. To make sure I'm clear, I am looking for the following capability:
[code:1:c331632fed]<if cond=="some condition"> some logic <if cond=="another condition"> some more logic </if> some logic perhaps </if> [/code:1:c331632fed] If this is possible, how do I do it with the Audium VFCs?
Subject: RE: Nested Ifs Replied by: Vance Vagell on 21-09-2007 04:17:23 PM Hi Joel,
You are right.
After digging deeper, I found that VoiceXML 2.0 does indeed support nested-if statements. While the spec itself is ambiguous on this point (in fact, the entire spec doesn't show an example of nested-ifs or even address the topic), the schema for valid VoiceXML does allow for this construct.
However, our VIfGroup class does not currently provide this functionality, per the following Javadoc note:
[quote:9ec78a5f1e]Note that at this time, despite the fact that the VoiceXML specification supports it, this class does not allow one if group to be placed inside another.[/quote:9ec78a5f1e]
You should be able to create equivalent logic using if, elseif, and else tags. However, if you have a particular scenario that specifically requires nested-if statements, you could use a VoiceXML Insert element to use any arbitrary VoiceXML your platform supports.
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: