Modify

Opened 5 years ago

#10723 new enhancement

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

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 (0)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Ryan J Ollos.

Add Comment


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

 
Note: See TracTickets for help on using tickets.