In ConfiForms we have a number of integration points where you can supply the data from your database tables or views directly to ConfiForms.
One of such integrations is using the ConfiForms Field Definition Rules action called "Lookup and set a DB value"
The table we use for the demo is with following structure
|1||ConfiForms add-on for Confluence|
|2||ConfiDoc add-on for Confluence|
|3||Smart Templates & Pages nice app|
Here is an example on how to use it. We wil have a simple form which will lookup the plugin link from a database table based on user selection and will set it to the text field (actually a field type called "link" to make the value clickable, but the techniques are the same)
The field "choice" is of type "db dropdown" and link is of type "link"
The form looks like this
We will add a ConfiForms Field Definition Rules macro to the game
In storage format it looks like this:
So what we do here...
- we set the rule to be triggered only when the value in field "choice" changes.
- we set it to execute only on user action
we configure it to set the value of the result into a field called link
Important note is what is this "pluginlink".. it is actually the column returned by the SQL lookup we configured (see the r)
- SQL uses the value from a selected dropdown (it is a dropdown, so we need an ID. See Accessing field values and properties for more details)
- When SQL query is executed we get the results back and use the value of a column "pluginlink" to set back to ConfiForms field link