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: 1 year 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 have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list 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

Topic revision: r3 - 2010-02-22 - JoshBoston
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by PerlIdeas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.