Search code examples
orbeon

How to setup Dynamic Data Dropdown control in Orbeon Forms CE?


I am a newcomer in the Orbeon forms and I am trying to use Dynamic Data Dropdown component with Orbeon Forms CE but nothing is displayed.

As an example, I am trying to fetch data from the following web service: http://api.geonames.org/earthquakes?north=44.1&south=-9.9&east=-22.4&west=55.2&username=demo&style=full

In order to use the aforementioned web service, I entered the following values in the provided fields:

"Choices XPath expression": "/geonames/earthquake",
"Label XPath expression": "@src" ,
"Value XPath expression: "@eqid"

Unfortunately, the dropdown component is always empty. Is something wrong with the values at these fields? Although, there is available documentation about this component, I've noticed that there is a broken link regarding the sample web service that is used in this documentation.

Thank you


Solution

  • I had the same problem. Your XML is like:

        <geonames>
           <earthquake>
              <src>us</src>
              <eqid>c0001xgp</eqid>
              <datetime>2011-03-11 04:46:23</datetime>
              <lat>38.322</lat>
              <lng>142.369</lng>
              <magnitude>8.8</magnitude>
              <depth>24.4</depth>
           </earthquake>
           ...
    

    @src is used in case you hace a XML node like <node src="something"/> but in your case what you need is to access to text between tags.

    Try with:

    "Choices XPath expression": "/geonames/earthquake",
    "Label XPath expression": "src/text()" ,
    "Value XPath expression: "eqid/text()"
    

    Hope it helps. Regards