Question
I am trying to set up a system where a user enters information in an input form. This creates a topic from a template with an included form that has data that user entered. On the template page, I also have an action which I want to populate with data from this form. This way, the user never has to deal with the
ActionTrackerPlugin syntax and the action is created automatically when someone creates the topic.
I have tried including a search which returns the required formfields within the
ActionTrackerPlugin attributes, but this didn't work. I also tried setting these search results as variables using
SpreadSheetPlugin SET and GET commands (See example below). It seems that
ActionTrackerPlugin can not expand these variables or search commands when saving the action. I am afraid this may be by design

. If this is the case, does anyone have any idea of how I might accomplish this?
Here is action I enter in preview window:
%ACTION{ state="open"
creator="%CALC{"$GET(created_by)"}%"
due="%CALC{"$GET(car_respond_due)"}%"
created="%CALC{"$GET(created_date)"}%"
who="%CALC{"$GET(car_assigned_to)"}%" }%
%CALC{"$GET(problem_description)"}%
Here is action after saving:
%ACTION{ state="open"
creator="Main.%CALC{"
due="23-Jun-2004"
created="23-Jun-2004"
who="Main.JeffE"
uid="000031" }%
" due="%CALC{"$GET(car_respond_due)"}%" created="%CALC{"$GET(created_date)"}%"
who="%CALC{"$GET(car_assigned_to)"}%" }% %CALC{"$GET(problem_description)"}%
Note: Line breaks added for readability
Update:
I have been working further on this and have tried about every kludge I could think of. I tried about every possible combination of TWiki search,
SpreadSheetPlugin SET and GET commands, and
FormQueryPlugin SET and CALLMACRO commands.
I got to a point (after tearing out my last 3 hairs

) where i can call the action from a macro that has
ActionTrackerPlugin syntax without the last % symbol so it is not rendered in macro topic.
%STRIP%%ACTION{ state="open" creator="%CREATOR%" due="%DUE%" created="%CREATED%" who="%WHO%" }
I use the SET command from
FormQueryPlugin to assign variables using TWiki search of formfields in topic. Then I use CALLMACRO to call the action syntax with variables inserted, then add the final % so
ActionTrackerPlugin should render the action.
%SET F1 = created_by
%SET F2 = car_respond_due
%SET F3 = created_date
%SET F4 = car_assigned_to
%SET F5 = problem_description
%SET SEARCHSTART =
%SET CREATOR = %SEARCHSTART%%F1%%SEARCHEND%
%SET DUE = %SEARCHSTART%%F2%%SEARCHEND%
%SET CREATED = %SEARCHSTART%%F3%%SEARCHEND%
%SET WHO = %SEARCHSTART%%F4%%SEARCHEND%
%SET DESCRIPTION = %SEARCHSTART%%F5%%SEARCHEND%
%CALLMACRO{topic=MacroCreateAction CREATOR="%CREATOR%" DUE="%DUE%" CREATED="%CREATED%" WHO="%WHO%"}%% %DESCRIPTION%
This displays a rendered action in preview mode with all proper values from variables inserted, except the name appears as
Main.DaveL instead of being resolved to a Wiki link. However, when I save the page it shows up as plain text and is not rendered as an action even though the syntax appears to be right.
%ACTION{ state="open" creator="Main.JeffE" due="2004/07/15" created="2004/06/23" who="Main.DaveL" }% Describe the problem requiring corrective action. Be detailed; include what, when, where.
I don't really know what to try from here, so I will be waiting to hear from one of you TWiki wizards.
--
JeffEaston - 25 Jun 2004
Environment
| TWiki version: |
TWikiRelease01Feb2003 |
| TWiki plugins: |
DefaultPlugin, EmptyPlugin, InterwikiPlugin, ActionTrackerPlugin, AliasPlugin, CommentPlugin, EditTablePlugin, EmbedPDFPlugin, HiddenTextPlugin, LocalCityTimePlugin, NotificationPlugin, PowerEditPlugin, SmiliesPlugin, SpreadSheetPlugin, TablePlugin |
| Server OS: |
Windows XP SP1 |
| Web server: |
Apache 1.3.31 |
| Perl version: |
5.6.1 Cygwin |
| Client OS: |
Windows XP SP1 |
| Web Browser: |
IE6 |
--
JeffEaston - 23 Jun 2004
Answer
Bloomin' 'eck, Jeff, talk about jumping through hoops!
The
ActionTrackerPlugin has a
beforeSaveHandler that auto-completes fields in actions during saves. There is no way to switch it off. This includes expansion of the creator and created fields, so the first observation I would make is that you probably don't want to include these fields in your template action.
It sounds from your update that you have resolved most of the problems and the only issue you still have is that the action saved is not shown rendered in the saved page. To understand this, you will have to view the topic "raw" (view the saved topic with
?raw=on appended to the URL) and tell me what you see. But it's probably due to one of the expanded macros inserting a newline (\n) into the saved text.
--
CrawfordCurrie - 29 Jun 2004
Why don't you use the action template coming with the
CommentPlugin to create your simplified input form? This works great. One just has to add
%COMMENT{type="action"}% where ever one wants people be able to add new action items (e.g. in topics collecting meeting minutes).
--
FranzJosefSilli - 29 Jun 2004
Thanks for your responses Crawford and Franz.
Crawford, the raw view shows exactly what I have above (with all the SET commands and the CALLMACRO). What seemed strange to me is that it does render as an action in preview mode, but doesn't once it's saved. I do have the %STRIP% command in the macro, so I don't think there's any new line. Also if I copy the text shown in saved view back into edit view, it previews and saves as a correct action.
Franz, I will take a look at that and se if it could work for my purposes. My goal is to have user fill out a simple form and then have the action generated from that data.
--
JeffEaston - 29 Jun 2004
Eliminating the newline risk, the only other idea I have is rendering order. Plugins render text in the order shown in %ACTIVATEDPLUGINS%, so the action tracker has to be in the rendering order
after the
FormQueryPlugin, so that the CALLMACRO gets expanded first. I think you can tweak the order using the INSTALLEDPLUGINS line in
TWikiPreferences (there's documentation somewhere).
Note that for action searches to work on generated actions they actually have to be in the .txt file as %ACTION lines. A CALLMACRO just won't work. Franz's solution is a very good one, IMHO.
--
CrawfordCurrie - 30 Jun 2004
There's been no further feedback on this so I'm assuming the question is answered. Please re-open it if it isn't!
--
CrawfordCurrie - 14 Aug 2004