Tags:
create new tag
, view all tags

Question

I need an EDITTABLE to have a column with some cells defined as EDITCELLS and others taking their values from previously defined variables.

e.g. The following...

%CALC{$SET(answer, No)}%

%TABLE{databg="none", dataalign="center, left"}%
%EDITTABLE{ header="on" defaultrows="on" format="| label, 0 | label, 0 | label, 0 | select, 1, , Fred, Bob | date, , ,%Y-%m-%d|" changerows="off"}%
| *Step No.* | *Description* | *Done?* | *Who* | *Date Complete* |
| 1 | Step 1. | %CALC{$GET(answer)}% |  |  |
| 2 | Step 2. | Yes %EDITCELL{select,1, ,Yes,No}% |  |  |

produces...

Step No. Description Done? Who Date Complete
1 Step 1. No    
2 Step 2. Yes    

Please don't save this table!

The trouble is that as soon as the table is saved the CALC is expanded. This means that if the variable set previously changes the table isn't updated.

Does anyone have any suggestions for alternative solutions. I read EditTableWithFormulas but placing the CALC in the header didn't work.

Environment

TWiki version: TWikiRelease04Sep2004 label select date
1 Step 1. No    
2 Step 2. No    

-- DavidBaker - 25 Apr 2006

Answer

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.

Looking at that topic it's in a label in the header with % as $percnt and then as normal in the cell. Let's try that:

Step No. Description Done? Who Date Complete
1 Step 1. No    
2 Step 2. Yes    

Here's what I did

%CALC{$SET(answer, No)}%
%TABLE{databg="none", dataalign="center, left"}%
%EDITTABLE{ header="on" defaultrows="on" format="|label,0|label,0|label,0,$percntCALC{$GET(answer)}$percnt|select,1,,Fred,Bob|date,,,%Y-%m-%d|" changerows="off"}%
| *Step No.* | *Description* | *Done?* | *Who* | *Date Complete* |
| 1 | Step 1. | %CALC{$GET(answer)}% |  |  |
| 2 | Step 2. | Yes %EDITCELL{select,1, ,Yes,No}% |  |  |

Edited the table and the CALC is preserved, however the edit I made to the table didn't get saved :/

-- SamHasler - 25 Apr 2006

I wonder if having two almost identical tables in the topic is causing problems?

Yes it was, try it in Sandbox.EditTableWithCALC

I've changed the status to AnsweredQuestions.

-- SamHasler - 25 Apr 2006

That's great - Thanks Sam. Unfortunately it doesn't work on my system. I copied your sandbox example to my system to try out. The %CALC... is translated to 'Yes' in the table cell when the table is saved. I can only think its something to do with my version of EditTable - I'm using the version that enables new rows to be inserted mid table. (I can't find the original link to this version)

-- DavidBaker - 25 Apr 2006

 
Topic revision: r5 - 2006-04-25 - DavidBaker
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, 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.