Modify

Opened 12 years ago

Closed 7 years ago

#10723 closed enhancement (wontfix)

Allow variables to be passed to the wikiprocessor

Reported by: Ryan J Ollos Owned by: Ryan J Ollos
Priority: normal Component: WikiTableMacro
Severity: normal Keywords:
Cc: Trac Release:

Description (last modified by Ryan J Ollos)

This was previously attached to the project wiki page:

I added below to render_macro to provide a rudimentary sort of variable function.

    def render_macro(self, req, name, content):
+        c = content.split("|;|")
+        content = c[0]
+        if len(c) > 1 :
+                for i in c[1:] :
+                        v = i.split("=")
+                        if len(v) > 1 :
+                                k = v[0]
+                                v = v[1]
+                                content = content.replace(k,v)

i.e. you can do something like this

{{{#!SQLTable
    SELECT "a", count($id) as 'Number of Tickets' 
    FROM ticket
    UNION
    SELECT "b", count($id) as 'Number of Tickets' 
    FROM ticket|;|$id=id
}}}

Useful when you have the same id that you don't want to keep on retyping over.

Attachments (0)

Change History (1)

comment:1 Changed 7 years ago by Ryan J Ollos

Description: modified (diff)
Resolution: wontfix
Status: newclosed

This appears to have pretty limited usefulness for WikiTableMacro.

WikiReportMacro supports dynamic variables and in that case the feature is more useful because the SQL from a report is being reused in each invocation of the macro.

Some dialects of SQL support setting variables.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.