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
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
Related
I’m using Oberon forms version 2019.2 CE.
I want to migrate autocomplete field to dynamic dropdown. As resource (Resource URL) I'm using address: <my_service_address>/name={$fr-search-value}¶m2={../c_field_name}
c_field_name is other dynamic dropdown.
When I’m using autocomplete everything is fine (correct response from service), but when I switch to dynamic dropdown the response is incorrect (empty response). It looks like {../c_field_name} is empty value.
When I pass some test value to my service (instead of {../c_field_name}), for example:
<my_service_address>/name={$fr-search-value}¶m2=1
everything work fine, so my service working well.
I tried to use $c_field_name instead of {../c_field_name}, but it is not worked.
Do you have any suggestions?
Instead of ../c_field_name, use xxf:instance('fr-form-instance')//c_field_name.
Also see the form attached to this message, which uses this technique to create chained dropdowns, where each dropdown passes to the service the value selected by the user in the previous dropdown. And ideally, you should be able to just write $c_field_name, which is covered by request for enhancement #309.
We are running a separate validation process against a set of multiple Orbeon forms so that we can display a full set of validation messages to the user in one place. We want to use the XPath expressions in relevant, required, and validation expressions within the form definitions as part of this process rather than duplicating those rules.
Is there a way we can call Orbeon to get the validation messages for a form, including meta data to match those messages with controls?
Alternately, we have tried to take the expressions and process them to work with our data. In our system we are using canonical names for controls which we use to store the data from multiple forms in a single XML structure. For example if we had a form set with two forms with the following fields:
Form A
now.applicantInformation.individualOrCompany
now.applicantInformation.relationshipToCompanyOrOrganization
now.applicantInformation.areYouTheIndividualThisAuthorizationWillBeIssuedTo
now.agentInformation.agentMailingAddress.addressType
now.agentInformation.agentMailingAddress.additionalAddressInformation
Form B
now.access.presentlyGated
now.access.inspectorHasKey
Our resulting data would look similar to this:
<now>
<applicantInformation>
<individualOrCompany>Organization</individualOrCompany>
<relationshipToCompanyOrOrganization>Agent</relationshipToCompanyOrOrganization>
<areYouTheIndividualThisAuthorizationWillBeIssuedTo>N</areYouTheIndividualThisAuthorizationWillBeIssuedTo>
</applicantInformation>
<agentInformation>
<agentMailingAddress>
<addressType>Rural Route</addressType>
<additionalAddressInformation></additionalAddressInformation>
</agentMailingAddress>
</agentInformation>
<access>
<presentlyGated>Y</presentlyGated>
<inspectorHasKey>N</inspectorHasKey>
</access>
</now>
For the field now.agentInformation.agentMailingAddress.additionalAddressInformation we have this relevant xpath expression:
(
(
$now.applicantInformation.applicantInformation.individualOrCompany='Organization'
and $now.applicantInformation.applicantInformation.relationshipToCompanyOrOrganization = ('Agent','Executor_Administrator_Trustee','Friend_Neighbour','Power of Attorney','Representative','Trustee in Bankruptcy')
)
or ($now.applicantInformation.applicantInformation.areYouTheIndividualThisAuthorizationWillBeIssuedTo='N')
)
and $now.applicantInformation.agentInformation.agentMailingAddress.addressType='Rural Route'
We thought we might be able to convert this to an xpath expression that would work with our data structure, like this:
(
(
/now/applicantInformation/applicantInformation/individualOrCompany/text() = 'Organization'
and /now/applicantInformation/applicantInformation/relationshipToCompanyOrOrganization/text() = ('Agent','Executor_Administrator_Trustee','Friend_Neighbour','Power of Attorney','Representative','Trustee in Bankruptcy')
)
or (/now/applicantInformation/applicantInformation/areYouTheIndividualThisAuthorizationWillBeIssuedTo/text() = 'N')
)
and /now/applicantInformation/agentInformation/agentMailingAddress/addressType/text() = 'Rural Route'
Unfortunately when we run this xpath expression from Java we get an error from this portion of the expression:
/now/applicantInformation/applicantInformation/relationshipToCompanyOrOrganization/text() = ('Agent','Executor_Administrator_Trustee','Friend_Neighbour','Power of Attorney','Representative','Trustee in Bankruptcy')
The error is:
expected ) but found ,
It seems that the the /element/text() = ('a','b','c') syntax is not supported by standard xpath. Is Orbeon able to support this by using XQuery or XForms?
We can convert this to use the OR operator but it is a bit ugly to do that:
/now/applicantInformation/applicantInformation/relationshipToCompanyOrOrganization[text() = 'Agent' or text() = 'Executor_Administrator_Trustee' or text() = 'Friend_Neighbour' or text() = 'Power of Attorney' or text() = 'Representative' or text() = 'Trustee in Bankruptcy' ]
We also have expressions that use functions such as days-from-duration. XPath has a days-from-duration function, but this appears to be different from the one used by Orbeon. An example expression is:
days-from-duration(($nda.technicalInformation.startAndEndDate.endDate) - ($nda.technicalInformation.startAndEndDate.startDate)) > 0
If you plan to run XPath expressions which run in Orbeon Forms from your own Java code, you will have to use the same XPath processor used in Orbeon Forms, and the same XPath function library. The alternative is to reinvent the wheel, and that will be very difficult.
Orbeon Forms has some abstractions for calling XPath, such as XPathCache and XPath. At this point this hasn't been designed to be used by third-party code outside of Orbeon Forms, so some work might be needed there.
Still, you could try to use that, or at the very least to use the Saxon XPath processor to get as close as possible.
Idealy, a form validation service would be offered as part of Orbeon Forms, and leverage existing validation code, but that's a new feature (see also #1357).
Im using orbeon 4.10 to collect data and fill back a PDF from a template. I would like to choose how the time is displayed on the pdf. I have seen the oxf.xforms.format.input.time and oxf.xforms.format.output.time properties, but they seem to only control the form itself.
I have also seen this, but it seems to relate to the date format.
What value do I need to change in my properties?
Thanks
UPDATE: I don't think my solution below actually works. I think this might have worked at some point but might not work anymore. We do have an RFE for this.
You can use the following property:
<property
as="xs:string"
name="oxf.fr.resource.$app.$form.$lang.print.formats.time"
value="[H01]:[m01]:[s01]]"/>
where:
$app is the app name
$form is the form name
$lang is the language which applies
You can use wildcards (*) for all of those.
As a workaround i used a Hidden field to format my time correctly for the pdf.
Here is the formating code :format-time($controlname, '[H01]:[m01]') that i used in the calculated value
Here is the visibility code : $fr-mode = 'email' for the pdf generated from email or $fr-mode = 'pdf' for pdf button.
In Umbraco 6.1, I need to add a field to a Document Type that gets it's possible values from a list that an admin user can add to via the back end.
I figured I'd do this by creating a Developer/Data Type of type XPath DropDownList and have that point to a folder in my Umbraco content through the XPath Expression //Configuration/lookup-lists/course-availability. I've set the Type of Document and Value to Node Id/
This drop down list isn't displaying the SimpleTextItems that are within this folder (its empty).
Any ideas?
I believe you're looking to select content from a specific folder in your content-tree, is this correct? Look into the Multi-Node Tree Picker in this case as you can configure this pick 1-n nodes in any specific folder or type..
If the above is not what you're looking for, you might also check the uComponents dropdown that an admin with access to the Developer section can edit the 'pre-values'.
Whatever you're looking for exactly - some data type in the uComponents package is most likely the answer. If not (u'd be surprised!), you may have to code your own .
Your XPath is incorrect.
your Xpath should be something like (loads all existing documents with doctype:SimpleText and in first level of Umbraco tree)
$ancestorOrSelf/ancestor-or-self::*[#level=1]/SimpleText
Please take a look at here to see correct Xpath samples for your dropdownlist
I am building a website where the user should have the capability of adding their School/University. I have noticed in LinkedIn, when i tried to type in my school name , it showed up a auto search box with all the schools, beginning with the letter i typed. How can i achieve the same functionality?
Do they save all the Universities in their database ? Or is there any Open webservices i can use that will show all the Schools/Universities ?
Thanks !
This feature is called "Auto Complete" and the text boxes are enabled with that. These allow you to filter the data required according to the characters you type in.
Please see this post for auto-complete feature implemented using jQuery.
Razor: Auto-complete text box inside jqGrid, How to bind values?
The example shown in that page lists all from the database. However, as a next phase, you can as well extend this feature to look for a WCF exposed service for universe of schools/colleges.
FYI" "GetSkillNameAutocomplete" is a method in the controller that takes a string parameter as an input (the search string) and gets the value(s).
Hope this helps!