Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This section lets you test your query with the actual data from the XML repository.

Results

There is a list named Parameter Values under this tab. The parameters added in the Parameters tab are also listed here with their Value box empty. Enter values for the listed parameters to trigger and test your query.

...

Parameters
Create parameters with name and value xpath XPath pairs to use data from form XML in the query.

...

List Item Formatting

Customizes format of the query result.

Display Text Format
Specify the format to display the result text. You can use XPath inside curly braces. Ex: {{name}} - {{id}}

Value Format
Specify the format of the value. You can use XPath inside curly braces. Ex:  {{id}} - {{type}}

...

Item XPath
Specifies item that will be listed in the control. If it is left empty, which is the same with as the * value, all resulting items are being listed.

Hierarchy XPath

Include Page
EMK:_Hierarchy XPathEMK:
_Hierarchy XPath

Mappings

Options to map the result data.

...

In order to map the selected data from the XQuery result into a node of the form, create a mapping by pressing Add New button.

...

The query below basically gathers data from forms, instances and workitems associatively and returns them in a the desired format.

Code Block
languagexml
titleXQuery Example
collapsetrue
for $i in /Instance

let $formNo := ($i/Number)
let $instance := unordered($i[Number=$formNo])[last()]
let $workItemId := unordered($instance/WorkItems/WorkItem/Id)[last()]
let $formDataId:= $i/WorkItems/WorkItem[last()]/DataId
let $form := form[data(@Id)=$formDataId]/PoolRoot

where 
($fNo = '' or ($formNo/text() = $fNo))
and ($startDate = '' or  ($i/Start >= $startDate))
and ($endDate = '' or  ($i/End <= $endDate)) 
and ($state = '' or ($i/State/text() = $state))
and ($department = '' or ($form/Departman/Id = $department))

order by $i/Start/text() descending

return 
<Result>
	<FormNo>{$i/Number/text()}</FormNo>
	<DocId>{$workItemId/text()}</DocId>
	<State>{$i/State/text()}</State>
	<StartDate>{$i/Start/text()}</StartDate>
	<EndDate>{$i/End/text()}</EndDate>
	<InitiatedBy>{$i/WorkItems/WorkItem[1]/CompletedBy/@Caption/string()}</InitiatedBy>
	<Subject>{$form/Konu/text()}</Subject>
	<File>{$form/Dosyalar/Dosya/Id/text()}</File>
</Result>

...

  • For expression loops over Instance nodes that are located on root level and assigns assign them to parameter $i
  • Let expression gathers several pieces of information depending on the instance, workitem and form data
  • Where expression applies criteria on to the data. Control parameters used in this section are declared in Parameters section on the same window.
  • Order expression orders the result according to the given value
  • Result expression returns the result data in the specified XML format
Code Block
languagexml
titleRenaming a node in XQuery
collapsetrue
for $unit in ProcessSettings/ResponsibleUnits/Unit[Name=$respUnit]

let $mainResp := $unit/MainResponsible

let $modifiedNode := (
    copy $b:=$mainResp
    modify rename node $b as 'ProjectManager'
    return $b
)

return $modifiedNode

The example above demonstrates how you can rename a node before returning it. This usage does not affect the original node name, only the returning node name is changed.

...

See Also

...