[Xsltforms-support] Cascading Dynamic Dropboxes (xf:select1). existdb templating framework
Brought to you by:
alain-couthures
|
From: Дмитрий С. <di...@ra...> - 2015-06-18 10:42:19
|
Hello everyone!
I'm working with existdb XForm and its HTML Templating Module (xquery logic)
Trying to make two cascaded dropboxes:
I. 1-st one loads data from database at XForm loading:
<xf:select1 ref="Region" selection="open" appearance="minimal" incremental="true">
<xf:label>Region: </xf:label>
<div data-template="app:get_regions"/>
</xf:select1>
xquery function "get_regions" in app module forms xf:item then processing XForm:
declare
function app:get_regions($node as node(), $model as map(*)) {
let $connection := sql:get-connection('oracle.jdbc.OracleDriver', 'my conn string')
let $q1 := "select distinct RG from ds8test.VLANMAP_64 where mr = 'FE' and rg not like ' ' order by rg"
let $qry := sql:execute( $connection, $q1, fn:true())
let $result := for $row at $pos in $qry//sql:row
let $rg := $row/sql:RG/text()
return
<xf:item>
<xf:label>{$rg}</xf:label>
<xf:value>{$rg}</xf:value>
</xf:item>
return $result
};
II. The second dropbox should be populated with values, when any option is selected in dropbox 1
Is it possible to do this by means of xquery functions? Or how should I do?
Thank you!
|