You are not logged in.
Pages: 1
I'm struggling a bit with computed columns for dynamic list reports. The documentation is somewhat limited and so far I've not been very successful. For example I'd like to create a computed column from an existing date column so I can group records by month or year. I've tried to use Postgres' date_part function:
date_part('month', submission_date)
but get a "Could not tokenize" error.
So I guess I'm wondering what kind of expressions can be used when creating computed columns. A few examples would probably go a long way.
Cheers,
/GvH
Offline
Hi,
you can use any expression, but there is a trick wich the documentation does not really give away. (There is a hint in the config guide, but it doesn't really catch the eye)
Look at the file /fileserver/etc/dynamiclists/computedcolumn.cf it contains a whitelist of valid expressions. Remember to reload your configuration if you made changes.
Cheers,
Thorsten
Ah! Missed that, looked in all the other manuals I also note that it seems all keywords have to be registered. The expression above wasn't good enough I realised, it had to be
date_part('month', CAST(submission_date AS DATE))
but for that to work I need this in computedcolumn.cf:
....
<function>date_part</function>
<function>cast</function>
<function>as</function>
<function>date</function>
</functions>
Though it might be good to note for others using computed columns.
As usual thanks for a speedy reply!
/GvH
Offline
Pages: 1