0
votes

I am creating a form using Form Builder. I have a section with 1 dynamic drop down element, named simple-query.

I created database service as follows:

  • Service name: simple-query
  • DataSource: prp
  • SQL Query:

    select OpsiName 
    from CPP_ORG_PartnerBusinessRelationshipItem 
    where 
    PartnerLocationId='70734968'
    

And an action as follows:

  • Action name:simple-query-action
  • Condition:Run always
  • Run Action when: the form loads - after the controls are ready
  • Service to Call:simple-query
  • Service Response Action
  • Set Control Choices > Simple Query(simple-query) >
  • Return one node for each choice: /response/row
  • Relative to choice tem node: OpsiName
  • Relative to choice node: OpsiName

I created test.jsp page in my orbeon web application to test the jdbc data source, and it was successful. But my drop down not populated. Anything I missed here?

1
In the Actions Editor, could you try changing OpsiName to opsiname, i.e. all lowercase? If that doesn't help, still leave it in lowercase, and when you open the form, monitor the orbeon.log; do you see any error there? - avernet
hi @avernet, seems that if the column name contains underscore ( _ ), the value will not be loaded. My column name was company_name, after I changed to companyname then it worked. - Chris
If it contains an underscore, that character is transformed in a dash. So if in your database you have company_name, then in Form Builder you should enter company-name. This was made way-back-when, with the idea that using dashes is more XML-like than underscores, but I understand how confusing this can be! And of course, avoiding the underscore, like you did, works as well! - avernet
I also posted an answer below, so people finding this through a search can save themselves the time of going through all the comments. - avernet

1 Answers

0
votes

Per Chris' comments, the issue was that the SQL query was doing a SELECT company_name FROM …. Because of the underscore in the column name, when referring to that column in Form Builder, you should us a dash, as in company-name.