Tags:
search1Add my vote for this tag tables1Add my vote for this tag create new tag
view all tags

SID-00753: How to query a TWiki table

Status: Answered 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

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title How to query a TWiki table
SupportCategory CategorySearch
TWiki version 4.2.3
Server OS

Web server

Perl version

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2010-02-22 - JoshBoston
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.