I'm creating a voicexml appliacation.
I want to store an user input into a global variable.
I wondered, the input should be stored in the fieldvar. shouldn't it? After I tried it with this, i tried to store it in an global variable:
<assign name="myvar" expr="'myinput'"/>
but somehow it didn't work. I used value expr="var" as expr.
<?xml version="1.0" encoding="UTF-8"?>
<vxml xmlns="http://www.w3.org/2001/vxml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/vxml
http://www.w3.org/TR/voicexml20/vxml.xsd"
version="2.0">
<var name="myProdukt" />
<form id="test">
<field name="var">
<prompt bargein="true" bargeintype="hotword" >Sagen Sie ein Produkt</prompt>
<grammar root="main" version="1.0" xml:lang="de-DE">
<rule id="main" scope="public">
<one-of>
<item> p1 </item>
<item> p2 </item>
<item> p3 </item>
<item> p4 </item>
</one-of>
</rule>
</grammar>
<filled>
<assign name="myProdukt" expr="<value expr="var"/>"/>
</filled>
</field>
</form>
<<!--[...] Here i want to use the input.-->
</vxml>
thanks in advance
---------------EDIT:
now i used this:
<filled>
test
<assign name="myProdukt" expr="var" />
</filled>
I only changed that. The Applications says "test" but then there is an error.
It isn'T allowed to use "var" instead I used an other name :-)
Did you try a simple assignment of field var to the variable myProdukt like so ?
<filled>
<assign name="myProdukt" expr="var"/>
</filled>
Which would be fine except that according to Section 5.1, Variables and Expressions of the Voice XML specification:
VoiceXML variables, including form
item variables, must not contain
ECMAScript reserved words.
So, you'll need to rename the field var to something that is not a reserved word in ECMAscript, say productSelection:
<field name="productSelection">
<!-- .. prompt, grammar as before .. -->
<filled>
<assign name="myProdukt" expr="productSelection"/>
</filled>
</field>
Related
The example xml looks like this:
<sales>
............
<customer custid="108">
<name>NORTH WOODS HEALTH AND FITNESS SUPPLY CENTER</name>
<address>98 LONE PINE WAY</address>
<city>HIBBING</city>
<state>MN</state>
<zip>55649</zip>
<area>612</area>
<phone>566-9123</phone>
<repid>7844</repid>
<creditlimit>8000</creditlimit>
<ord ordid="613">
<orderdate>1987-02-01</orderdate>
<shipdate>1987-02-01</shipdate>
<total>6400</total>
<item itemid="1">
<product_ref ref="100871"/>
<actualprice>5.6</actualprice>
<qty>100</qty>
<itemtot>560</itemtot>
</item>
</ord>
</customer>
<product prodid="100860">
<descrip>ACE TENNIS RACKET I</descrip>
<price>
<stdprice>35</stdprice>
<minprice>28</minprice>
<startdate>1986-06-01</startdate>
</price>
</product>
.........
</sales>
let $product := doc('sales.xml')/sales/product
for $item in doc('sales.xml')/sales/customer/ord/item
where $item/actualprice < $product[#prodid=$item/product_ref/#ref]/price/minprice
return $item
And I get as result this:
<item itemid="1">
<product_ref ref="100861"/>
<actualprice>35</actualprice>
<qty>1</qty>
<itemtot>35</itemtot>
</item>
<item itemid="3">
<product_ref ref="101863"/>
<actualprice>10</actualprice>
<qty>150</qty>
<itemtot>1500</itemtot>
</item>
<item itemid="7">
<product_ref ref="101863"/>
<actualprice>12.5</actualprice>
<qty>200</qty>
<itemtot>2500</itemtot>
</item>
<item itemid="5">
<product_ref ref="101863"/>
<actualprice>9</actualprice>
<qty>100</qty>
<itemtot>900</itemtot>
</item>
But the items with ref=101863 are not right. Only the item with id=5 is less then minprice.
Why does this error occur? Tried a lot of different queries but it gives me always the same result.
It works fine with ref=100861.
Assuming the query isn't schema-aware, you are comparing the two prices as strings, not as numbers. You need to convert both to numbers before comparison.
I am trying override base email template(noupdate=1) but, unable to override. Also, search for my issue but didn't get proper solution.
So, anybody can help me for this issue.
my code is like:
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<!-- Email template for reset password -->
<delete id="auth_signup.reset_password_email" model="mail.template"/>
<record id="reset_password_email" model="mail.template">
. . .
</record>
<!-- Email template for new users -->
<delete id="auth_signup.set_password_email" model="mail.template"/>
<record id="set_password_email" model="mail.template">
. . .
</record>
</data>
</odoo>
This error comes when create new user:
ValueError: External ID not found in the system: auth_signup.reset_password_email
Thanks in advance
well, you don't need to override the existing email template. you may need a new one. you could also delete the old one
<record id="reset_password_email" model="mail.template">
<field name="name">Auth Signup: Reset Password</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="subject">Password reset</field>
<field name="email_from">"${object.company_id.name | safe}" <${(object.company_id.email or user.email) | safe}></field>
<field name="email_to">${object.email_formatted | safe}</field>
<field name="body_html" type="html">
<p>whatever email template you want & remember you could use OBJECT AS FOLLOWING</p>
<span style="font-size: 20px; font-weight: bold;">
${object.name}
</span>
</field>
<field name="lang">${object.lang}</field>
<field name="auto_delete" eval="True"/>
<field name="user_signature" eval="False"/>
</record>
please note that you custom template id would be names as custom_module.reset_password_email & it will replace auth_signup.reset_password_email.
or you could follow:
Odoo - How to update non updateable records by XML
I want to return a result on all the books which contain the "databases" attribute in inside of "field".
for $e in //testbook[field="databases"]
return $e/title
Sample of the .xml file:
<?xml version="1.0" encoding="UTF-?>
<testbook>
<book>
<author> AuthorGuy </author>
<title> theBook</title>
<field> databases </field>
</book>
</testbook>
There are two issues:
<title/> and <field/> elements are contained in a <book/> element, and are not direct children of <testbook/>, fix the path expressions.
The <field/> tag contains the field wrapped in whitespace, use contains($string, $needle) instead of a simple comparison.
A working example:
let $document := document{<testbook>
<book>
<author> AuthorGuy </author>
<title> theBook</title>
<field> databases </field>
</book>
</testbook>}
for $e in $document//testbook[contains(book/field, "databases")]
return $e/book/title
I am new to Xquery, I want to change the given xml into another xml format.
Given XML:
<?xml version="1.0" encoding="UTF-8"?>
<Store>
<consumer id="H01">
<name>John Doe</name>
<items>
<item type = "Torch">
<price>$3</price>
</item>
<item type = "Gas">
<price>$4</price>
</item>
</items>
</consumer >
<consumer id="H05">
<name>Jane Doe</name>
<items>
<item type = "Cell">
<price>$8</price>
</item>
<item type = "Shirt">
<price>$12</price>
</item>
</items>
</consumer>
Desired XML Format:
<Store>
<user>
<number><id>H01</id><name>John Doe</name></number>
<number><id>H05</id><name>Jane Doe</name></number>
</user>
<inventory>
<number><type>Torch</type><price>$3</price></number>
<number><type>Gas</type><price>$4</price></number>
<number><type>Cell</type><price>$8</price></number>
<number><type>Shirt</type><price>$12</price></number>
</inventory>
</Store>
Xquery I made:
for $customer in distinct-values(doc("../xml/store.xml")/store/consumer/#id)
let $name := doc("../xml/store.xml")/store/consumer[#id=$customer]/name
for $object in distinct- values(doc("../xml/store.xml")/store/consumer[#id=$customer]/items/item/#type)
return
<store>
<user>
<number>
<id>{$customer}</id>
{$name}
</number>
</user>
<inventory>
<number>
<type>{$object}</type>
</number>
</inventory>
</store>
Where exactly am I going wrong? Is there a way we could make attributes as new node elements.
your two for clauses are nested, you don't want that in this case. I would do something like this:
let $doc := doc("../xml/store.xml")
let $customerIds := distinct-values($doc/store/consumer/#id)
return
<store>
<user>{for $customerId in $customerIds
let $consumer := $doc/store/consumer[#id=$customerId]
return <number><id>{data($consumer/#id)}</id><name>{$consumer/name}</name></number>
}
</user>
<inventory>
similar thing for items
</inventory>
</store>
Is there a way we could make attributes as new node elements.
Yes you can for example use the data() function to extract the text. See example above.
I am having trouble processing a dtmf within a record tag.
I am looking to identify the zero entered during recording and perform specific action based on the value. zero could be entered anytime before or after speaking.
With the following snippet I see that when I enter zero, the application exits. It looks like the block tag is reached, but then processing terminates. I am not sure what the problem is here. Or is there a better way to acheive the same?
I also referred the answer here: VoiceXML - Recognize DTMF in Recording, but need more details.
<form id="recordMessage">
<property name="termchar" value="" />
<property name="inputmodes" value="dtmf" />
<var name="lastdtmfchar" expr="1"/>
<record name="recording" beep="true" maxtime="120s" dtmfterm="false" type="audio/wav">
<grammar mode="dtmf" version="1.0" root="dtmfSettings" xmlns="http://www.w3.org/2001/06/grammar">
<rule id="dtmfSettings" >
<one-of>
<item>0</item>
<item>#</item>
</one-of>
</rule>
</grammar>
<filled>
<assign name="lastdtmfchar" expr="recording$.termchar"/>
<if cond = "recording$.termchar == '#'">
<prompt> Hash entered
</prompt>
</if>
<if cond = "recording$.termchar == '0'">
<prompt> zero entered
</prompt>
</if>
</filled>
</record>
<block>
<if cond = "lastdtmfchar == '1'">
<prompt> block value not assigned
</prompt>
</if>
<if cond = "lastdtmfchar == '#'">
<prompt> block hash entered
</prompt>
</if>
<if cond = "lastdtmfchar == '0'">
<prompt> block zero entered
</prompt>
</if>
</block>
There is only this record tag in the form, but the root doc has all the handlers..
<vxml .....>
<catch event="connection.disconnect.hangup">
<goto next="${hangupUrl}?cause=hangup" />
</catch>
<catch event="connection.disconnect">
<goto next="${hangupUrl}?cause=disconnect" />
</catch>
<catch event="error">
<prompt>
<audio src="${goodbyeUrl">
</audio>
</prompt>
<exit/>
</catch>
<catch event="*">
<prompt>
<audio src="${goodbyeUrl">
</audio>
</prompt>
<exit/>
</catch>
<property name="termchar" value="#"/>
<link dtmf="0" next="${globalHandlerUrl}">
</link>
</vxml>
As you mentioned, dtmfterm = false may be the reason.
You can get the grammar matched character by accessing application.lastresult$. Refer http://www.w3.org/TR/voicexml20/#dml2.3.6
Agree with #kevin that in IVRs, a lot of things depend on the vendor itself (using a grammar in record is itself optional in the spec)