SID-01764: Searching database and returning results to table
| Status: |
Answered |
TWiki version: |
5.1.3 |
Perl version: |
|
| Category: |
CategoryPlugins |
Server OS: |
|
Last update: |
10 years ago |
Hi,
We have a form with a field that requires a specific ID. The user would not know what that ID is so I want to provide some sort of lookup functionality where they can search the database for some string, return the results that match to some table, then allow them to select the ID they want and populate the form field.
I was thinking I could do some sort of form submit that would take the search value and use that to build the database search sql (
DatabasePlugin), with the results populating a Twiki table (though not sure where that table could go- a popup?). The results format could build a URL for each table item; clicking a link would call javascript to populate the original ID field with that selected item.
I feel like Twiki plugins provide most of the elements; i just can't figure out how to put them together. Is the flow mentioned above possible solely within the Twiki framework?
Any thoughts?
Thanks,
Justin
--
Justin Martin - 2013-07-10
Discussion and Answer
You do not need to install a plugin, TWiki has database capabilities built into the engine. See blog
How to Create a TWiki Application. Details in
TWikiForms,
VarSEARCH,
FormattedSearch,
QuerySearch. FYI, this support application is built using TWiki forms and formatted searches.
--
Peter Thoeny - 2013-07-11
Thanks, there is a lot I can use from that post. When you say Twiki has database capabilities, do you mean interacting with an external db, or using Twiki for the db itself? Our data is in DB2. That particular example stores the contact info within Twiki, so let me ask a more specific question. How would I go about querying a db based on a search string and returning the results? Could those functions you mention be used for db searches or oly Twiki searches?
--
Justin Martin - 2013-07-11
Look into the
DatabasePlugin and
DBIQueryPlugin. Both allow you to embed SQL in TWiki pages to query a TWiki-external database.
--
Peter Thoeny - 2013-07-11
Closing this question after more than 30 days of inactivity. Feel free to reopen if needed. Consider engaging one of the
TWiki consultants if you need timely help. We invite you to
get involved with the community, it is more likely you get community support if you support the open source project!
--
Peter Thoeny - 2015-12-03
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.