You are here: Foswiki>Tasks Web>Item5642 (05 Jul 2015, GeorgeClark)Edit Attach

Item5642: IF seems to be evaluated in the context of the INCLUDEd topic, not the BASETOPIC

pencil
Priority: Normal
Current State: Closed
Released In: 2.0.0
Target Release: major
Applies To: Engine
Component: INCLUDE, IfStatement
Branches: master
Reported By: Foswiki:Main.SvenDowideit
Waiting For:
Last Change By: GeorgeClark
so if you have an information header that you INCLUDE into a topic, that tries to do an IF based on the form fields of the BASETOPIC, it fails - form.name appears to be the formname of the INCLUDEd topic.
%<nop>IF{"form.name~'*IsoManageMetaTemplate' AND fields[name='ApprovedRevision']" then="%REVINFO{'$rev'}%"}% 

I still need to confirm this is always true - at this point, I am INCLUDING from a view templat, but even then its problematic.

-- TWiki:Main/SvenDowideit - 21 May 2008

this leads to shenanigins like
%REVINFO{"$rev" topic="%FORMFIELD{"EditDocument" format="%BASEWEB%.%BASETOPIC%" topic="%BASEWEB%.%BASETOPIC%"}%%FORMFIELD{"ApprovedDocument" topic="%BASEWEB%.%BASETOPIC%" default="%BASEWEB%.%BASETOPIC%"}%"}%

-- TWiki:Main.SvenDowideit - 21 May 2008

An otherwise unqualified name is evaluated in the context of the meta-data object of the "current" topic. If the "topic" field in the meta-data were modified when a topic was included, I might have expected this. AFAIK, though, the stack for included topic names is local to the TWiki instance, so I don't know how this could happen.

Do you have a testcase?

-- Foswiki:Main.CrawfordCurrie - 28 Jul 2008

No feedback sine July 2008.

Before it hits the 1 year birthday I No Action this.

-- KennethLavrsen - 16 Jun 2009

do not close bugs just because I've been busy. This is i actually a complex issue, and its not like i have left.

its not as though you have a company evaluation based on your open bug count. I use these to remind me.

-- SvenDowideit - 17 Jun 2009

I am not chasing you. I am closing anyones bugs if they are being requested feedback and do not provide it. This one was from July 2008!!

Someone has to clean out in the bug reports. We have 200 or 300 open reports now. Most of them will rot. Most are problems that solved themselves. Or non-issues.

If you are working on it set it to Being Worked On. I will not close those even if they get old.

-- KennethLavrsen - 17 Jun 2009

This bug report is now 1.5 years old. And last time I No actioned it I was smacked on my fingers so I will let others No Action this one.

The problem this raise is that we have hundreds of stalled bug items so the important ones that need quick attention drown in the mud. Sometimes we need to walk through and close the ones that we can see with never be touched again. Otherwise we will have 1000 Normal bugs in a year. And we are closing a huge amount of bugs weekly so it is not a critique of the dev community. We do an incredible work. But we must clean out the bugs database regularly. Otherwise we loose the overview.

-- KennethLavrsen - 09 Jan 2010

I just noted the exact same behaviour with VarQUERY, and Sven reminded me that the macro is evaluated in the context of its %WEB% and %TOPIC%, not %BASEWEB% and %BASETOPIC%. So it seems funny to see that Sven had this similar confusion years ago smile Could we close this task by perhaps adding some documentation to the QuerySearch syntax topic? I'd rather not clutter the VarMACRO topics themselves.

P.S. Thanks GeorgeClark for categorising these tasks so that I could discover this old buglet (I came in by looking at the IfStatement component)

-- PaulHarvey - 30 Apr 2011

Added gotcha note as recommended.

-- Main.CrawfordCurrie - 20 Jun 2015 - 07:33

ItemTemplate edit

Summary IF seems to be evaluated in the context of the INCLUDEd topic, not the BASETOPIC
ReportedBy Foswiki:Main.SvenDowideit
Codebase
SVN Range TWiki-5.0.0, Sun, 04 May 2008, build 16770
AppliesTo Engine
Component INCLUDE, IfStatement
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:5c72c601fda3
TargetRelease major
ReleasedIn 2.0.0
CheckinsOnBranches master
trunkCheckins
masterCheckins distro:5c72c601fda3
ItemBranchCheckins
Release01x01Checkins
Topic revision: r12 - 05 Jul 2015, GeorgeClark
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