New Foswiki release 2.1.6 is available with important security fixes.
Sourceforge foswiki email lists being discontinued. Subscribe to the new Foswiki announce and discuss lists at MailingLists
This question about Missing functionality: Answered

Is there a possibility to use a variable defined in one topic in another?

Let's say I have two topics in my Sandbox-Web. The first is called "ExampleTopic1" and the second "ExampleTopic2". Now i define in "ExampleTopic1" a section:
%STARTSECTION{"CWNDefinition" type="section"}%
   * Set CWN = %SEARCH{"'CWForm'" type="query" web="Sandbox" topic="%TOPIC%" nosearch="on"  nototal="on"  format="$formfield(C W Name)"}%
%ENDSECTION{"CWNDefinition" type="section"}%

If i type in "ExampleTopic1"
i get "ExampleName", which is the value of my search request.

Now i want to get this variable in "ExampleTopic2". Therefore I tried to include the section "CWNDefinition" from "ExampleTopic1":

%INCLUDE{"Sandbox.MyCustomerWorkflow" section="CWNDefinition"}%

If i type in "ExampleTopic2"
i get
instead of "ExampleName". Is there a way to get my form variable in "ExampleTopic2"?

-- JeyBu 28 Feb 2014

No, Foswiki macros / variables are local to the topic and cannot be set using an include. A possible workaround is to use the SpreadSheetPlugin $SET variables which do cross topic boundaries.

See BestPracticeTip33 for more information

-- GeorgeClark - 28 Feb 2014

QuestionForm edit

Subject Missing functionality
Status Answered
Related Topics
Topic revision: r2 - 28 Feb 2014, GeorgeClark - This page was cached on 14 Aug 2018 - 05:09.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy