ForEachPlugin

Loop over successive elements of a list, or a range of numbers

Syntax Rules

Tag Description
%FOREACH{"_var_" in="_list_"}% body %NEXT{"_var_"}% Loop over _body_ setting control variable _var_ to each successive element of _list_
%FOR{"_var_" start="_int_" stop="_int_" step="_int_"}% body %NEXT{"_var_"}% Loop over _body_ setting control variable _var_ to each integer in the range start to stop in steps of step

Parameters Description
FOREACH
"..." Loop control variable. Within the body of the text this may be referred to as $var. %FOREACH{"var" ...}% must have a matching %NEXT{"var"}%
in="..." Comma separated list. May contain TWiki Variables
FOR
"..." Loop control variable. Within the body of the text this may be referred to as $var. %FOR{"var" ...}% must have a matching %NEXT{"var"}%
"start"="..." Starting integer
"stop"="..." Stop integer
"step"="..." Increment/decrement var in steps of step. THIS IS REQUIRED

  • All parameters are required, and must appear in the specified order.

FOREACH Examples

Basic Usage

%FOREACH{"web" in="Main, Sandbox, TWiki"}%
   * [[$web.WebHome]]
%NEXT{"web"}%

... gives ...

... if installed.

Nested loops are possible:

%FOREACH{"i" in="1, 2, 3"}% %FOREACH{"j" in="a, b, c"}% $i$j %NEXT{"j"}% %NEXT{"i"}%
1a 1b 1c 2a 2b 2c 3a 3b 3c

Lists may contain TWiki Variables or other plugins.

  • The body of the loop may need to delay expansion: use $percnt to replace % if necessary.
%FOREACH{"web" in="%WEBLIST{"$name" separator=", "}%"}%
| $web | $percntFORMFIELD{"STATUS" topic="$web.%HOMETOPIC%" default="Formfield STATUS not defined in $web" alttext="Formfield STATUS not found in $web"}$percnt |
%NEXT{"web"}%
ABATBEA Formfield STATUS not found in ABATBEA
ABATBEA/ABATBEAArchive Formfield STATUS not found in ABATBEA/ABATBEAArchive
ABCOHT Formfield STATUS not found in ABCOHT
ABCOHT/ABCOHTArchive Formfield STATUS not found in ABCOHT/ABCOHTArchive
ABPComputing Formfield STATUS not found in ABPComputing
ABPComputing/ABPComputingArchive Formfield STATUS not found in ABPComputing/ABPComputingArchive
ABSafety Formfield STATUS not found in ABSafety
ABSafety/ABSafetyArchive Formfield STATUS not found in ABSafety/ABSafetyArchive
Achelois Formfield STATUS not found in Achelois
Achelois/AcheloisArchive Formfield STATUS not found in Achelois/AcheloisArchive
ACPP Formfield STATUS not found in ACPP
ACPP/ACPPArchive Formfield STATUS not found in ACPP/ACPPArchive
ADCgroup Formfield STATUS not found in ADCgroup
ADCgroup/ADCgroupArchive Formfield STATUS not found in ADCgroup/ADCgroupArchive
AfricaMap Formfield STATUS not found in AfricaMap
AfricaMap/AfricaMapArchive Formfield STATUS not found in AfricaMap/AfricaMapArchive
AIDA2020WP8 Formfield STATUS not found in AIDA2020WP8
AliceEbyE Formfield STATUS not found in AliceEbyE
AlicePhos Formfield STATUS not found in AlicePhos
AlicePhos/AlicePhosArchive Formfield STATUS not found in AlicePhos/AlicePhosArchive
ALICEpublic Formfield STATUS not found in ALICEpublic
ALICEpublic/ALICEpublicArchive Formfield STATUS not found in ALICEpublic/ALICEpublicArchive
AliceSPD Formfield STATUS not found in AliceSPD
AliceSPD/AliceSPDArchive Formfield STATUS not found in AliceSPD/AliceSPDArchive
AliceSSD Formfield STATUS not found in AliceSSD
AliceSSD/AliceSSDArchive Formfield STATUS not found in AliceSSD/AliceSSDArchive
AliceTOF Formfield STATUS not found in AliceTOF
AliceTOF/AliceTOFArchive Formfield STATUS not found in AliceTOF/AliceTOFArchive
AliFemto Formfield STATUS not found in AliFemto
AliFemto/AliFemtoArchive Formfield STATUS not found in AliFemto/AliFemtoArchive
AMS Formfield STATUS not found in AMS
AMS/AMSArchive Formfield STATUS not found in AMS/AMSArchive
ArdaGrid Formfield STATUS not found in ArdaGrid
ArdaGrid/ArdaGridArchive Formfield STATUS not found in ArdaGrid/ArdaGridArchive
Aspen2011YearOneLHC Formfield STATUS not found in Aspen2011YearOneLHC
Aspen2011YearOneLHC/Aspen2011YearOneLHCArchive Formfield STATUS not found in Aspen2011YearOneLHC/Aspen2011YearOneLHCArchive
AthenaFCalTBAna Formfield STATUS not found in AthenaFCalTBAna
AthenaFCalTBAna/AthenaFCalTBAnaArchive Formfield STATUS not found in AthenaFCalTBAna/AthenaFCalTBAnaArchive
AtlasArchive Formfield STATUS not found in AtlasArchive
Atlas/delete/MuonsInCaloCSCNote Formfield STATUS not found in Atlas/delete/MuonsInCaloCSCNote
Atlas/DistributedDataManagement/LocalReplicaCatalog Formfield STATUS not found in Atlas/DistributedDataManagement/LocalReplicaCatalog
Atlas/DistributedDataManagement/LocalReplicaCatalog/LocalReplicaCatalogArchive Formfield STATUS not found in Atlas/DistributedDataManagement/LocalReplicaCatalog/LocalReplicaCatalogArchive
AtlasMdtDcs Formfield STATUS not found in AtlasMdtDcs
AtlasMdtDcs/AtlasMdtDcsArchive Formfield STATUS not found in AtlasMdtDcs/AtlasMdtDcsArchive
AtlasPublic Formfield STATUS not found in AtlasPublic
AtlasPublic/AtlasPublicArchive Formfield STATUS not found in AtlasPublic/AtlasPublicArchive
AtlasSandbox Formfield STATUS not found in AtlasSandbox
AtlasSandbox/AtlasSandboxArchive Formfield STATUS not found in AtlasSandbox/AtlasSandboxArchive
AXIALPET Formfield STATUS not found in AXIALPET
AXIALPET/AXIALPETArchive Formfield STATUS not found in AXIALPET/AXIALPETArchive
BEABP Formfield STATUS not found in BEABP
BEABP/BEABPArchive Formfield STATUS not found in BEABP/BEABPArchive
BEBIPM Formfield STATUS not found in BEBIPM
BEBIPM/BEBIPMArchive Formfield STATUS not found in BEBIPM/BEBIPMArchive
BGV Formfield STATUS not found in BGV
BGV/BGVArchive Formfield STATUS not found in BGV/BGVArchive
BL4S Formfield STATUS not found in BL4S
BL4S/BL4SArchive Formfield STATUS not found in BL4S/BL4SArchive
BWSUpgrade Formfield STATUS not found in BWSUpgrade
BWSUpgrade/BWSUpgradeArchive Formfield STATUS not found in BWSUpgrade/BWSUpgradeArchive
CALICE Formfield STATUS not found in CALICE
CALICE/CALICEArchive Formfield STATUS not found in CALICE/CALICEArchive
CENF Formfield STATUS not found in CENF
CENF/CENFArchive Formfield STATUS not found in CENF/CENFArchive
CERNTR Formfield STATUS not found in CERNTR
CERNTR/CERNTRArchive Formfield STATUS not found in CERNTR/CERNTRArchive
CLIC Formfield STATUS not found in CLIC
CLIC/CDR Formfield STATUS not found in CLIC/CDR
CLIC/CDR/CDRArchive Formfield STATUS not found in CLIC/CDR/CDRArchive
CLIC/CLICArchive Formfield STATUS not found in CLIC/CLICArchive
Cloud Formfield STATUS not found in Cloud
Cloud/CloudArchive Formfield STATUS not found in Cloud/CloudArchive
CLS Formfield STATUS not found in CLS
CLS/CLSArchive Formfield STATUS not found in CLS/CLSArchive
CMS/DatabaseAccess Formfield STATUS not found in CMS/DatabaseAccess
CMS/DatabaseAccess/DatabaseAccessArchive Formfield STATUS not found in CMS/DatabaseAccess/DatabaseAccessArchive
CMS/DCS Formfield STATUS not found in CMS/DCS
CMS/DCS/DCSArchive Formfield STATUS not found in CMS/DCS/DCSArchive
CMS/EcalDQM Formfield STATUS not found in CMS/EcalDQM
CMS/EcalDQM/EcalDQMArchive Formfield STATUS not found in CMS/EcalDQM/EcalDQMArchive
CMS/HCAL Formfield STATUS not found in CMS/HCAL
CMS/HCAL/DCS Formfield STATUS not found in CMS/HCAL/DCS
CMS/HCAL/DCS/DCSArchive Formfield STATUS not found in CMS/HCAL/DCS/DCSArchive
CMS/HCAL/HCALArchive Formfield STATUS not found in CMS/HCAL/HCALArchive
CMS/PixelDQM Formfield STATUS not found in CMS/PixelDQM
CMS/PixelDQM/DQMframework Formfield STATUS not found in CMS/PixelDQM/DQMframework
CMS/PixelDQM/DQMframework/DQMframeworkArchive Formfield STATUS not found in CMS/PixelDQM/DQMframework/DQMframeworkArchive
CMS/PixelDQM/PixelDQMArchive Formfield STATUS not found in CMS/PixelDQM/PixelDQMArchive
CMS/ProdOps/ProdOps142 Formfield STATUS not found in CMS/ProdOps/ProdOps142
CMS/ProdOps/ProdOps142/ProdOps142Archive Formfield STATUS not found in CMS/ProdOps/ProdOps142/ProdOps142Archive
CMSPublic Formfield STATUS not found in CMSPublic
CMSPublic/CMSPublicArchive Formfield STATUS not found in CMSPublic/CMSPublicArchive
Compass/HighpTLowQ2 Formfield STATUS not found in Compass/HighpTLowQ2
Compass/HighpTLowQ2/HighpTLowQ2Archive Formfield STATUS not found in Compass/HighpTLowQ2/HighpTLowQ2Archive
Compass/Offline Formfield STATUS not found in Compass/Offline
Compass/Offline/OfflineArchive Formfield STATUS not found in Compass/Offline/OfflineArchive
Compass/PolarizedTarget Formfield STATUS not found in Compass/PolarizedTarget
Compass/PolarizedTarget/PolarizedTargetArchive Formfield STATUS not found in Compass/PolarizedTarget/PolarizedTargetArchive
Compass/Sandbox Formfield STATUS not found in Compass/Sandbox
Compass/Sandbox/SandboxArchive Formfield STATUS not found in Compass/Sandbox/SandboxArchive
Compass/SIDIS Formfield STATUS not found in Compass/SIDIS
Compass/SIDIS/SIDISArchive Formfield STATUS not found in Compass/SIDIS/SIDISArchive
Compass/SlowControl Formfield STATUS not found in Compass/SlowControl
Compass/SlowControl/SlowControlArchive Formfield STATUS not found in Compass/SlowControl/SlowControlArchive
Compass/Transversity Formfield STATUS not found in Compass/Transversity
Compass/Transversity/TransversityArchive Formfield STATUS not found in Compass/Transversity/TransversityArchive
Compass/Trigger Formfield STATUS not found in Compass/Trigger
Compass/Trigger/TriggerArchive Formfield STATUS not found in Compass/Trigger/TriggerArchive
Confluence Formfield STATUS not found in Confluence
Confluence/ConfluenceArchive Formfield STATUS not found in Confluence/ConfluenceArchive
CS/Public Formfield STATUS not found in CS/Public
CUAHEP Formfield STATUS not found in CUAHEP
CvmFS Formfield STATUS not found in CvmFS
CvmFS/CvmFSArchive Formfield STATUS not found in CvmFS/CvmFSArchive
D4Science Formfield STATUS not found in D4Science
D4Science/D4ScienceArchive Formfield STATUS not found in D4Science/D4ScienceArchive
DatabaseVersion3 Formfield STATUS not found in DatabaseVersion3
DatabaseVersion3/DatabaseVersion3Archive Formfield STATUS not found in DatabaseVersion3/DatabaseVersion3Archive
DB Formfield STATUS not found in DB
DefaultWeb Formfield STATUS not found in DefaultWeb
DefaultWeb/DefaultWebArchive Formfield STATUS not found in DefaultWeb/DefaultWebArchive
DemoWebsite Formfield STATUS not found in DemoWebsite
DemoWebsite/DemoWebsiteArchive Formfield STATUS not found in DemoWebsite/DemoWebsiteArchive
DMLHC/DMLHCArchive Formfield STATUS not found in DMLHC/DMLHCArchive
DPM Formfield STATUS not found in DPM
DPM/DPMArchive Formfield STATUS not found in DPM/DPMArchive
DREAM Formfield STATUS not found in DREAM
DREAM/DREAMArchive Formfield STATUS not found in DREAM/DREAMArchive
ECFA Formfield STATUS not found in ECFA
ECFA/ECFAArchive Formfield STATUS not found in ECFA/ECFAArchive
Edutech Formfield STATUS not found in Edutech
Edutech/EdutechArchive Formfield STATUS not found in Edutech/EdutechArchive
EGEE Formfield STATUS not found in EGEE
EGEE/EGEEArchive Formfield STATUS not found in EGEE/EGEEArchive
EgeePtf Formfield STATUS not found in EgeePtf
EgeePtf/EgeePtfArchive Formfield STATUS not found in EgeePtf/EgeePtfArchive
EIWG Formfield STATUS not found in EIWG
EIWG/EIWGArchive Formfield STATUS not found in EIWG/EIWGArchive
ELearning Formfield STATUS not found in ELearning
ELearning/ELearningArchive Formfield STATUS not found in ELearning/ELearningArchive
EMI Formfield STATUS not found in EMI
EMI/EMIArchive Formfield STATUS not found in EMI/EMIArchive
EMI/EMIMessaging Formfield STATUS not found in EMI/EMIMessaging
EMI/EMIMessaging/EMIMessagingArchive Formfield STATUS not found in EMI/EMIMessaging/EMIMessagingArchive
EMI/Messaging Formfield STATUS not found in EMI/Messaging
EMI/Messaging/MessagingArchive Formfield STATUS not found in EMI/Messaging/MessagingArchive
ENELHTProjects Formfield STATUS not found in ENELHTProjects
ENELHTProjects/ENELHTProjectsArchive Formfield STATUS not found in ENELHTProjects/ENELHTProjectsArchive
EOS Formfield STATUS not found in EOS
EOS/EOSArchive Formfield STATUS not found in EOS/EOSArchive
ETICS Formfield STATUS not found in ETICS
ETICS/ETICSArchive Formfield STATUS not found in ETICS/ETICSArchive
FASER Formfield STATUS not found in FASER
FlukaTeam Formfield STATUS not found in FlukaTeam
FlukaTeam/FlukaTeamArchive Formfield STATUS not found in FlukaTeam/FlukaTeamArchive
Frontier Formfield STATUS not found in Frontier
Frontier/FrontierArchive Formfield STATUS not found in Frontier/FrontierArchive
Gaudi Formfield STATUS not found in Gaudi
Gaudi/GaudiArchive Formfield STATUS not found in Gaudi/GaudiArchive
Geant4 Formfield STATUS not found in Geant4
Geant4/Geant4Archive Formfield STATUS not found in Geant4/Geant4Archive
GeneratorServices Formfield STATUS not found in GeneratorServices
GeneratorServices/Alpgen Formfield STATUS not found in GeneratorServices/Alpgen
GeneratorServices/Alpgen/AlpgenArchive Formfield STATUS not found in GeneratorServices/Alpgen/AlpgenArchive
GeneratorServices/ExampleFAQ Formfield STATUS not found in GeneratorServices/ExampleFAQ
GeneratorServices/ExampleFAQ/ExampleFAQArchive Formfield STATUS not found in GeneratorServices/ExampleFAQ/ExampleFAQArchive
GeneratorServices/GeneratorServicesArchive Formfield STATUS not found in GeneratorServices/GeneratorServicesArchive
GeneratorServices/Pythia6 Formfield STATUS not found in GeneratorServices/Pythia6
GeneratorServices/Pythia6/Pythia6Archive Formfield STATUS not found in GeneratorServices/Pythia6/Pythia6Archive
GeneratorServices/SHERPA Formfield STATUS not found in GeneratorServices/SHERPA
GeneratorServices/SHERPA/SHERPAArchive Formfield STATUS not found in GeneratorServices/SHERPA/SHERPAArchive
GLiteSlc4 Formfield STATUS not found in GLiteSlc4
GLiteSlc4/GLiteSlc4Archive Formfield STATUS not found in GLiteSlc4/GLiteSlc4Archive
GuidesInfo Formfield STATUS not found in GuidesInfo
GuidesInfo/GuidesInfoArchive Formfield STATUS not found in GuidesInfo/GuidesInfoArchive
HardwareLabs Formfield STATUS not found in HardwareLabs
HardwareLabs/HardwareLabsPublic Formfield STATUS not found in HardwareLabs/HardwareLabsPublic
HardwareLabs/HardwareLabsPublic/HardwareLabsPublicArchive Formfield STATUS not found in HardwareLabs/HardwareLabsPublic/HardwareLabsPublicArchive
HCC Formfield STATUS not found in HCC
HCC/HCCArchive Formfield STATUS not found in HCC/HCCArchive
HEPIX Formfield STATUS not found in HEPIX
HEPIX/HEPIXArchive Formfield STATUS not found in HEPIX/HEPIXArchive
HEPIX/TechwatchNetwork Formfield STATUS not found in HEPIX/TechwatchNetwork
HEPTape Formfield STATUS not found in HEPTape
HEPTape/HEPTapeArchive Formfield STATUS not found in HEPTape/HEPTapeArchive
ILCBDSColl Formfield STATUS not found in ILCBDSColl
ILCBDSColl/ILCBDSCollArchive Formfield STATUS not found in ILCBDSColl/ILCBDSCollArchive
ILCTPC Formfield STATUS not found in ILCTPC
ILCTPC/ILCTPCArchive Formfield STATUS not found in ILCTPC/ILCTPCArchive
Inspire Formfield STATUS not found in Inspire
Inspire/InspireArchive Formfield STATUS not found in Inspire/InspireArchive
IONSUpgrade Formfield STATUS not found in IONSUpgrade
IONSUpgrade/IONSUpgradeArchive Formfield STATUS not found in IONSUpgrade/IONSUpgradeArchive
IPMSim Formfield STATUS not found in IPMSim
IPMSim/IPMSimArchive Formfield STATUS not found in IPMSim/IPMSimArchive
IPv6 Formfield STATUS not found in IPv6
IPv6/IPv6Archive Formfield STATUS not found in IPv6/IPv6Archive
ITAnalyticsWorkingGroup Formfield STATUS not found in ITAnalyticsWorkingGroup
ITAnalyticsWorkingGroup/ITAnalyticsWorkingGroupArchive Formfield STATUS not found in ITAnalyticsWorkingGroup/ITAnalyticsWorkingGroupArchive
ItCommTeam Formfield STATUS not found in ItCommTeam
ItCommTeam/ItCommTeamArchive Formfield STATUS not found in ItCommTeam/ItCommTeamArchive
ITGT Formfield STATUS not found in ITGT
ITGT/ITGTArchive Formfield STATUS not found in ITGT/ITGTArchive
ITSDC Formfield STATUS not found in ITSDC
ITSDC/ITSDCArchive Formfield STATUS not found in ITSDC/ITSDCArchive
Know Formfield STATUS not found in Know
Know/KnowArchive Formfield STATUS not found in Know/KnowArchive
LAr Formfield STATUS not found in LAr
LAr/LArArchive Formfield STATUS not found in LAr/LArArchive
LCG Formfield STATUS not found in LCG
LCGAAWorkbook Formfield STATUS not found in LCGAAWorkbook
LCGAAWorkbook/LCGAAWorkbookArchive Formfield STATUS not found in LCGAAWorkbook/LCGAAWorkbookArchive
LCG/LCGArchive Formfield STATUS not found in LCG/LCGArchive
Leade Formfield STATUS not found in Leade
Leade/LeadeArchive Formfield STATUS not found in Leade/LeadeArchive
LeptonColliderPlatform Formfield STATUS not found in LeptonColliderPlatform
LHCb Formfield STATUS not found in LHCb
LHCbBackup Formfield STATUS not found in LHCbBackup
LHCbBackup/LHCbBackupArchive Formfield STATUS not found in LHCbBackup/LHCbBackupArchive
LHCb/FAQ Formfield STATUS not found in LHCb/FAQ
LHCb/FAQ/FAQArchive Formfield STATUS not found in LHCb/FAQ/FAQArchive
LHCb/LHCbArchive Formfield STATUS not found in LHCb/LHCbArchive
LHCb/LHCbOT Formfield STATUS not found in LHCb/LHCbOT
LHCb/LHCbOT/LHCbOTArchive Formfield STATUS not found in LHCb/LHCbOT/LHCbOTArchive
LHCb/RichOperations Formfield STATUS not found in LHCb/RichOperations
LHCb/RichOperations/RichOperationsArchive Formfield STATUS not found in LHCb/RichOperations/RichOperationsArchive
LHCb/SettingsMc09/CrossSections Formfield STATUS not found in LHCb/SettingsMc09/CrossSections
LHCb/SettingsMc09/CrossSections/CrossSectionsArchive Formfield STATUS not found in LHCb/SettingsMc09/CrossSections/CrossSectionsArchive
LHCDMF Formfield STATUS not found in LHCDMF
LHCDMF/LHCDMFArchive Formfield STATUS not found in LHCDMF/LHCDMFArchive
LHCDMWG Formfield STATUS not found in LHCDMWG
LHCgas Formfield STATUS not found in LHCgas
LHCgas/LHCgasArchive Formfield STATUS not found in LHCgas/LHCgasArchive
LHCONE Formfield STATUS not found in LHCONE
LHCONE/LHCONEArchive Formfield STATUS not found in LHCONE/LHCONEArchive
LHCOPN Formfield STATUS not found in LHCOPN
LHCOPN/LHCOPNArchive Formfield STATUS not found in LHCOPN/LHCOPNArchive
LHCPhysics Formfield STATUS not found in LHCPhysics
LHCPhysics/Higgs Formfield STATUS not found in LHCPhysics/Higgs
LHCPhysics/Higgs/HiggsArchive Formfield STATUS not found in LHCPhysics/Higgs/HiggsArchive
LHCPhysics/LHCPhysicsArchive Formfield STATUS not found in LHCPhysics/LHCPhysicsArchive
LinuxSupport Formfield STATUS not found in LinuxSupport
LinuxSupport/LinuxSupportArchive Formfield STATUS not found in LinuxSupport/LinuxSupportArchive
LPCCForwardPhysics Formfield STATUS not found in LPCCForwardPhysics
LPCCForwardPhysics/LPCCForwardPhysicsArchive Formfield STATUS not found in LPCCForwardPhysics/LPCCForwardPhysicsArchive
LumiDet Formfield STATUS not found in LumiDet
LumiDet/LumiDetArchive Formfield STATUS not found in LumiDet/LumiDetArchive
Main Formfield STATUS not found in Main
Main/COOL Formfield STATUS not found in Main/COOL
Main/COOL/COOLArchive Formfield STATUS not found in Main/COOL/COOLArchive
Main/DanielHayden/GymAtCERN Formfield STATUS not found in Main/DanielHayden/GymAtCERN
Main/DanielHayden/GymAtCERN/GymAtCERNArchive Formfield STATUS not found in Main/DanielHayden/GymAtCERN/GymAtCERNArchive
Main/DavideGerbaudo Formfield STATUS not found in Main/DavideGerbaudo
Main/DavideGerbaudo/DavideGerbaudoArchive Formfield STATUS not found in Main/DavideGerbaudo/DavideGerbaudoArchive
Main/JessicaLeveque Formfield STATUS not found in Main/JessicaLeveque
Main/JessicaLeveque/JessicaLevequeArchive Formfield STATUS not found in Main/JessicaLeveque/JessicaLevequeArchive
Main/MainArchive Formfield STATUS not found in Main/MainArchive
Main/MassimoPaladin Formfield STATUS not found in Main/MassimoPaladin
Main/MassimoPaladin/MassimoPaladinArchive Formfield STATUS not found in Main/MassimoPaladin/MassimoPaladinArchive
Main/NateOdell Formfield STATUS not found in Main/NateOdell
Main/NateOdell/NateOdellArchive Formfield STATUS not found in Main/NateOdell/NateOdellArchive
Main/NathanielOdell Formfield STATUS not found in Main/NathanielOdell
Main/NathanielOdell/NathanielOdellArchive Formfield STATUS not found in Main/NathanielOdell/NathanielOdellArchive
Main/OlegFedin/PNPI Formfield STATUS not found in Main/OlegFedin/PNPI
Main/OlegFedin/PNPI/PNPIArchive Formfield STATUS not found in Main/OlegFedin/PNPI/PNPIArchive
Main/OpenLoops Formfield STATUS not found in Main/OpenLoops
Main/OpenLoops/OpenLoopsArchive Formfield STATUS not found in Main/OpenLoops/OpenLoopsArchive
Main/PedroAndrade Formfield STATUS not found in Main/PedroAndrade
Main/PedroAndrade/PedroAndradeArchive Formfield STATUS not found in Main/PedroAndrade/PedroAndradeArchive
Main/RiccardoTravaglini Formfield STATUS not found in Main/RiccardoTravaglini
Main/RiccardoTravaglini/RiccardoTravagliniArchive Formfield STATUS not found in Main/RiccardoTravaglini/RiccardoTravagliniArchive
Main/RobertCalkins Formfield STATUS not found in Main/RobertCalkins
Main/RobertCalkins/RobertCalkinsArchive Formfield STATUS not found in Main/RobertCalkins/RobertCalkinsArchive
Main/SteveTraylen Formfield STATUS not found in Main/SteveTraylen
Main/SteveTraylen/SteveTraylenArchive Formfield STATUS not found in Main/SteveTraylen/SteveTraylenArchive
Main/TWiki/COOL Formfield STATUS not found in Main/TWiki/COOL
Main/TWiki/COOL/COOLArchive Formfield STATUS not found in Main/TWiki/COOL/COOLArchive
Main/WebHome/GymAtCERN Formfield STATUS not found in Main/WebHome/GymAtCERN
Main/WebHome/GymAtCERN/GymAtCERNArchive Formfield STATUS not found in Main/WebHome/GymAtCERN/GymAtCERNArchive
MimosaTelescope Formfield STATUS not found in MimosaTelescope
MimosaTelescope/MimosaTelescopeArchive Formfield STATUS not found in MimosaTelescope/MimosaTelescopeArchive
MPGD Formfield STATUS not found in MPGD
MPGD/MPGDArchive Formfield STATUS not found in MPGD/MPGDArchive
Muonboy/Staco Formfield STATUS not found in Muonboy/Staco
Muonboy/Staco/StacoArchive Formfield STATUS not found in Muonboy/Staco/StacoArchive
NTOFPublic Formfield STATUS not found in NTOFPublic
NTOFPublic/NTOFPublicArchive Formfield STATUS not found in NTOFPublic/NTOFPublicArchive
P326 Formfield STATUS not found in P326
P326/P326Archive Formfield STATUS not found in P326/P326Archive
PanDA Formfield STATUS not found in PanDA
PanDA/PanDAArchive Formfield STATUS not found in PanDA/PanDAArchive
PDF4LHC Formfield STATUS not found in PDF4LHC
PDF4LHC/PDF4LHCArchive Formfield STATUS not found in PDF4LHC/PDF4LHCArchive
Persistency Formfield STATUS not found in Persistency
Persistency/CoralServer Formfield STATUS not found in Persistency/CoralServer
Persistency/CoralServer/CoralServerArchive Formfield STATUS not found in Persistency/CoralServer/CoralServerArchive
Persistency/PersistencyArchive Formfield STATUS not found in Persistency/PersistencyArchive
Persistency/Private Formfield STATUS not found in Persistency/Private
Persistency/Private/PrivateArchive Formfield STATUS not found in Persistency/Private/PrivateArchive
Plugins Formfield STATUS not found in Plugins
Plugins/PluginsArchive Formfield STATUS not found in Plugins/PluginsArchive
ProtonLinacs Formfield STATUS not found in ProtonLinacs
ProtonLinacs/ProtonLinacsArchive Formfield STATUS not found in ProtonLinacs/ProtonLinacsArchive
PSAccessRenovation Formfield STATUS not found in PSAccessRenovation
PSAccessRenovation/PSAccessRenovationArchive Formfield STATUS not found in PSAccessRenovation/PSAccessRenovationArchive
PSBHalfSectorTest Formfield STATUS not found in PSBHalfSectorTest
PSBHalfSectorTest/PSBHalfSectorTestArchive Formfield STATUS not found in PSBHalfSectorTest/PSBHalfSectorTestArchive
PSBUpgrade Formfield STATUS not found in PSBUpgrade
PSBUpgrade/PSBUpgradeArchive Formfield STATUS not found in PSBUpgrade/PSBUpgradeArchive
PSSGroup Formfield STATUS not found in PSSGroup
PSSGroup/PSSGroupArchive Formfield STATUS not found in PSSGroup/PSSGroupArchive
PSUpgrade Formfield STATUS not found in PSUpgrade
PSUpgrade/PSUpgradeArchive Formfield STATUS not found in PSUpgrade/PSUpgradeArchive
R2Eproject Formfield STATUS not found in R2Eproject
R2Eproject/R2EprojectArchive Formfield STATUS not found in R2Eproject/R2EprojectArchive
RCTF Formfield STATUS not found in RCTF
RCTF/RCTFArchive Formfield STATUS not found in RCTF/RCTFArchive
ReteQuarkonii Formfield STATUS not found in ReteQuarkonii
ReteQuarkonii/ReteQuarkoniiArchive Formfield STATUS not found in ReteQuarkonii/ReteQuarkoniiArchive
RooStats Formfield STATUS not found in RooStats
RooStats/RooStatsArchive Formfield STATUS not found in RooStats/RooStatsArchive
Sandbox Formfield STATUS not found in Sandbox
Sandbox/CERNonly Formfield STATUS not found in Sandbox/CERNonly
Sandbox/CERNonly/CERNonlyArchive Formfield STATUS not found in Sandbox/CERNonly/CERNonlyArchive
Sandbox/Dashboard Formfield STATUS not found in Sandbox/Dashboard
Sandbox/Dashboard/DashboardArchive Formfield STATUS not found in Sandbox/Dashboard/DashboardArchive
Sandbox/ExampleWeb Formfield STATUS not found in Sandbox/ExampleWeb
Sandbox/ExampleWeb/ExampleWebArchive Formfield STATUS not found in Sandbox/ExampleWeb/ExampleWebArchive
Sandbox/FlorianTeischingerSandbox Formfield STATUS not found in Sandbox/FlorianTeischingerSandbox
Sandbox/FlorianTeischingerSandbox/FlorianTeischingerSandboxArchive Formfield STATUS not found in Sandbox/FlorianTeischingerSandbox/FlorianTeischingerSandboxArchive
Sandbox/MedAustron Formfield STATUS not found in Sandbox/MedAustron
Sandbox/MedAustron/MedAustronArchive Formfield STATUS not found in Sandbox/MedAustron/MedAustronArchive
Sandbox/OpenLoops Formfield STATUS not found in Sandbox/OpenLoops
Sandbox/OpenLoops/OpenLoopsArchive Formfield STATUS not found in Sandbox/OpenLoops/OpenLoopsArchive
Sandbox/OpenLoopsProjects Formfield STATUS not found in Sandbox/OpenLoopsProjects
Sandbox/OpenLoopsProjects/OpenLoopsProjectsArchive Formfield STATUS not found in Sandbox/OpenLoopsProjects/OpenLoopsProjectsArchive
Sandbox/PedrameBargassaSandbox Formfield STATUS not found in Sandbox/PedrameBargassaSandbox
Sandbox/PedrameBargassaSandbox/LIPsw Formfield STATUS not found in Sandbox/PedrameBargassaSandbox/LIPsw
Sandbox/PedrameBargassaSandbox/LIPsw/LIPswArchive Formfield STATUS not found in Sandbox/PedrameBargassaSandbox/LIPsw/LIPswArchive
Sandbox/PedrameBargassaSandbox/PedrameBargassaSandboxArchive Formfield STATUS not found in Sandbox/PedrameBargassaSandbox/PedrameBargassaSandboxArchive
Sandbox/SandboxArchive Formfield STATUS not found in Sandbox/SandboxArchive
SDT/SDTArchive Formfield STATUS not found in SDT/SDTArchive
Search Formfield STATUS not found in Search
Search/SearchArchive Formfield STATUS not found in Search/SearchArchive
SGE_Yaim_Version2 Formfield STATUS not found in SGE_Yaim_Version2
SGE_Yaim_Version2/SGE_Yaim_Version2Archive Formfield STATUS not found in SGE_Yaim_Version2/SGE_Yaim_Version2Archive
SoapFP7 Formfield STATUS not found in SoapFP7
SoapFP7/SoapFP7Archive Formfield STATUS not found in SoapFP7/SoapFP7Archive
SocialActivities Formfield STATUS not found in SocialActivities
SocialActivities/SocialActivitiesArchive Formfield STATUS not found in SocialActivities/SocialActivitiesArchive
SPI Formfield STATUS not found in SPI
SPI/SPIArchive Formfield STATUS not found in SPI/SPIArchive
SPL Formfield STATUS not found in SPL
SPL/Linac4Web Formfield STATUS not found in SPL/Linac4Web
SPL/Linac4Web/Linac4WebArchive Formfield STATUS not found in SPL/Linac4Web/Linac4WebArchive
SPL/SplWeb Formfield STATUS not found in SPL/SplWeb
SPL/SplWeb/SplWebArchive Formfield STATUS not found in SPL/SplWeb/SplWebArchive
SRMDev Formfield STATUS not found in SRMDev
SRMDev/SRMDevArchive Formfield STATUS not found in SRMDev/SRMDevArchive
SSM Formfield STATUS not found in SSM
SSM/SSMArchive Formfield STATUS not found in SSM/SSMArchive
Student Formfield STATUS not found in Student
Student/PB Formfield STATUS not found in Student/PB
Student/PB/PBArchive Formfield STATUS not found in Student/PB/PBArchive
Student/PBrzo Formfield STATUS not found in Student/PBrzo
Student/PBrzo/PBrzoArchive Formfield STATUS not found in Student/PBrzo/PBrzoArchive
Student/PBrzozow Formfield STATUS not found in Student/PBrzozow
Student/PBrzozow/PBrzozowArchive Formfield STATUS not found in Student/PBrzozow/PBrzozowArchive
Student/StudentArchive Formfield STATUS not found in Student/StudentArchive
Student/SVH Formfield STATUS not found in Student/SVH
Student/SVH/SVHArchive Formfield STATUS not found in Student/SVH/SVHArchive
SuperComputing Formfield STATUS not found in SuperComputing
SuperComputing/SuperComputingArchive Formfield STATUS not found in SuperComputing/SuperComputingArchive
Support Formfield STATUS not found in Support
Support/SupportArchive Formfield STATUS not found in Support/SupportArchive
SystemOnChip Formfield STATUS not found in SystemOnChip
T2K Formfield STATUS not found in T2K
T2K/T2KArchive Formfield STATUS not found in T2K/T2KArchive
TestWebDelete Formfield STATUS not found in TestWebDelete
TestWebDelete/TestWebDeleteArchive Formfield STATUS not found in TestWebDelete/TestWebDeleteArchive
TifNoteOnAlignment Formfield STATUS not found in TifNoteOnAlignment
TifNoteOnAlignment/TifNoteOnAlignmentArchive Formfield STATUS not found in TifNoteOnAlignment/TifNoteOnAlignmentArchive
TMVA Formfield STATUS not found in TMVA
TMVA/TMVAArchive Formfield STATUS not found in TMVA/TMVAArchive
TWiki Formfield STATUS not found in TWiki
TWiki21Nov Formfield STATUS not found in TWiki21Nov
TWiki21Nov/TWiki21NovArchive Formfield STATUS not found in TWiki21Nov/TWiki21NovArchive
TWiki432 Formfield STATUS not found in TWiki432
TWiki432/TWiki432Archive Formfield STATUS not found in TWiki432/TWiki432Archive
TWiki/TWikiArchive Formfield STATUS not found in TWiki/TWikiArchive
UNOSAT Formfield STATUS not found in UNOSAT
UNOSAT/UNOSATArchive Formfield STATUS not found in UNOSAT/UNOSATArchive
Virtualization Formfield STATUS not found in Virtualization
Virtualization/VirtualizationArchive Formfield STATUS not found in Virtualization/VirtualizationArchive
VOBox Formfield STATUS not found in VOBox
VOBox/VOBoxArchive Formfield STATUS not found in VOBox/VOBoxArchive
WLCGDatalakes Formfield STATUS not found in WLCGDatalakes
XdaqWiki Formfield STATUS not found in XdaqWiki
XdaqWiki/Help Formfield STATUS not found in XdaqWiki/Help
XdaqWiki/Help/HelpArchive Formfield STATUS not found in XdaqWiki/Help/HelpArchive
XdaqWiki/Image Formfield STATUS not found in XdaqWiki/Image
XdaqWiki/Image/ImageArchive Formfield STATUS not found in XdaqWiki/Image/ImageArchive
XdaqWiki/Talk Formfield STATUS not found in XdaqWiki/Talk
XdaqWiki/Talk/TalkArchive Formfield STATUS not found in XdaqWiki/Talk/TalkArchive
XdaqWiki/User Formfield STATUS not found in XdaqWiki/User
XdaqWiki/User/UserArchive Formfield STATUS not found in XdaqWiki/User/UserArchive
XdaqWiki/Xdaqwiki Formfield STATUS not found in XdaqWiki/Xdaqwiki
XdaqWiki/XdaqWikiArchive Formfield STATUS not found in XdaqWiki/XdaqWikiArchive
XdaqWiki/Xdaqwiki/XdaqwikiArchive Formfield STATUS not found in XdaqWiki/Xdaqwiki/XdaqwikiArchive
XdaqWiki/Xdata Formfield STATUS not found in XdaqWiki/Xdata
XdaqWiki/Xdata/XdataArchive Formfield STATUS not found in XdaqWiki/Xdata/XdataArchive
XdaqWiki/Xgi Formfield STATUS not found in XdaqWiki/Xgi
XdaqWiki/Xgi/XgiArchive Formfield STATUS not found in XdaqWiki/Xgi/XgiArchive
XdaqWiki/XMAS Formfield STATUS not found in XdaqWiki/XMAS
XdaqWiki/XMAS/XMASArchive Formfield STATUS not found in XdaqWiki/XMAS/XMASArchive
XDC Formfield STATUS not found in XDC
XTCA Formfield STATUS not found in XTCA
XTCA/XTCAArchive Formfield STATUS not found in XTCA/XTCAArchive

FOR Examples

Count up and down in steps

  • %FOR{"counta" start="1" stop="10" step="2"}% $counta %NEXT{"counta"}%
  • 1 3 5 7 9
  • %FOR{"countb" start="1" stop="10" step="1"}% $countb %NEXT{"countb"}%
  • 1 2 3 4 5 6 7 8 9 10
  • %FOR{"countc" start="10" stop="1" step="-1"}% $countc %NEXT{"countc"}%
  • 10 9 8 7 6 5 4 3 2 1

Nested loops are possible:

%FOR{"outer" start="1" stop="3" step="1"}%
%FOR{"inner" start="3" stop="1" step="-1"}%
   * $outer - $inner 
%NEXT{"inner"}%
%NEXT{"outer"}%
  • 1 - 103
  • 1 - 102
  • 1 - 101
  • 1 - 100
  • 2 - 103
  • 2 - 102
  • 2 - 101
  • 2 - 100
  • 3 - 103
  • 3 - 102
  • 3 - 101
  • 3 - 100

Error trapping

  • %FOR{"countd" start="10" stop="1" step="1"}% $countd %NEXT{"countd"}% (invalid step)
  • FOR countd : Bad step
  • %FOR{"counte" start="a" stop="b" step="c"}% $countd %NEXT{"counte"}% (non-integers)
  • FOR{"counte" start="a" stop="b" step="c"} : Not a number

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Loop over successive elements of a list, or a range of numbers

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip ForEachPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/ForEachPlugin.txt Plugin topic
    lib/TWiki/Plugins/ForEachPlugin.pm Plugin Perl module
  • Test if the installation was successful:
    • See if above examples work

Plugin Info

Plugin Author: TWiki:Main.MagnusLewisSmith
Copyright: © 2005, TWiki:Main.MagnusLewisSmith;
© 2005-2010, TWiki:TWiki.TWikiContributor
License: GPL (GNU General Public License)
Plugin Version: 19384 (2010-08-28)
Change History:  
2010-08-28: TWikibug:Item6571 - doc improvements; changing TWIKIWEB to SYSTEMWEB
2005-09-28: Initial version
TWiki Dependency: $TWiki::Plugins::VERSION 1.024
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle nn%, FormattedSearch nn%, ForEachPlugin nn%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/ForEachPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/ForEachPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/ForEachPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins

Topic revision: r0 - 2010-08-28 - TWikiContributor
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    TWiki All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.ForEachPlugin