SID-00753: How to query a TWiki table
| Status: |
Answered |
TWiki version: |
4.2.3 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
|
Last update: |
16 years ago |
I'm trying to make a TWiki page with a table with say 6 columns, and have some of the values in some columns pulled in from a table on a separate page e.g.
| Name1 |
Phone1 |
Name2 |
Phone2 |
Name3 |
Phone3 |
What I want to do is have an
EditTable so that someone can edit the first row and select values for Name1, Name2, and Name3 from a list of pre-defined names (in the edit table definition).
Then, when saving the table, I want the Phone1 field to lookup the phone number of "Name1" from a table on a separate page. This separate table would look something like:
| Name |
Phone |
| Foo |
123 |
| Bar |
456 |
Sounds fairly simple, and I can get a simple 2 column table working with
FormattedSearch, but this falls down when there are multiple columns (I might need to change my regex).
Is there a simple way to do this? Ideally I'd like to be able to query an existing table saying something like "select Phone from X where Name = %CALC{$T(R2:C1)}%". Is there a plugin for this?
OR even better - is there a way to tell the
EditTable that when "Foo" is chosen in the Name1 (or Name2, Name3) field, the value in Phone1 should be "123"?
--
JoshBoston - 2010-02-12
Discussion and Answer
Rather than messing around with regular expressions I recommend you to look into
TWikiForms based applications with
QuerySearch and
FormattedSearch. This allows you to easily run queries and build tables dynamically. This support application is a sample TWiki forms based application.
--
PeterThoeny - 2010-02-12
Thanks Peter, I think I can achieve what I'm trying to do by having a TWiki form on each contacts page (foo, bar, etc) with a form field for their phone number and look it up from there.
--
JoshBoston - 2010-02-22
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.