Tags:
create new tag
view all tags

SID-01768: Using %INCLUDE% within Database plugin

Status: Answered Answered TWiki version: 5.1.3 Perl version:
Category: DatabasePlugin Server OS: Last update: 12 years ago

I'm trying to run some sql and they embed the results into an %INCLUDE%. The goal is to create a database-driven form that can build the appropriate form controls by referencing a seperate "widgets" topic, passing in parameters to the INCLUDE from the db results. For example,

%DATABASE{"MSDB2:Database}%" sql="select control_type from table" format="%INCLUDE{"FormControls" CONTROL_TYPE="$control_type"}%" }%

Is this possible? I'm trynig to do this and it doesn't seem to resolve $control_type before passing it to the include.

Thanks Justin

-- Justin Martin - 2013-07-24

Discussion and Answer

By default, TWiki evaluates variables inside-out, left to right. You need to escape the INCLUDE placed inside DATABASE_SQL if you want to have it evaluated after the DATABASE_SQL.

Untested: format="$percntINCLUDE{\"FormControls\" CONTROL_TYPE=\"$control_type\"}$percnt"

-- Peter Thoeny - 2013-07-24

Brilliant, thanks

-- Justin Martin - 2013-07-24

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Using %INCLUDE% within Database plugin
SupportCategory DatabasePlugin
TWiki version 5.1.3
Server OS

Web server

Perl version

Browser & version

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2013-07-24 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.