Search code examples
mysqldatabaseformsorbeon

Extract value from form and send to database service how a parameter (filter)


In my configuration, I try the next comand (BD mysql):

SELECT user, name, lastname FROM Cordloc 
where user=<sql:param type="xs:string" select="/form/section-1/usuario"/>

This database service is conect to drowpdown, but when I incluye the sentence "where user=<sql:param type="xs:string" select="/form/section-1/usuario"/>", this it's not working.

I try the show en drowdown name user, but filter with user login orbeon (in the table is same value "orbeon").

Please, can your help me with that.

Many thanks.


Solution

  • You can't use an XPath expression, such as /form/section-1/usuario, in the query. Instead, the value of the select attribute must be left empty (as mentioned in 1. Set a service parameter).

    Instead, you "feed" the value to the service from the action. In the Actions Editor, under Set Database Service Parameters, you can say that the value from a given field should be used for a parameter of your SQL query.