Project

General

Profile

Actions

Feature #17295

open

Pipe-separated column names as processors

Added by Krzysztof Putyra 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Assignee:
Krzysztof Putyra
Target version:
-
Start date:
16.11.2023
Due date:
% Done:

0%

Estimated time:
Discuss:
Prio Planung:
No
Vote:

Description

The syntax
   <value> AS 'col1|col2|col3' 

can represent a processing queue of value by three processors with the output of last one taken as the column value. In this example the process queue is
             +------+     +------+     +------+
<value> -->--| col1 |-->--| col2 |-->--| col3 |-->-- <processed>
             +------+     +------+     +------+

A column processor may populate more values into a store, that are accessed using the notation <colname>.<property>. Standard properties include
  • in - the value that the processor has received
  • out - the output of the processor (the rendered input)

Processors of special columns can add more properties. For instance, link can populate url, tooltip, text, etc.

Should the values be inherited by following processors? For instance, with the column name _link|myvar should {{myvar.url:R}} be defined?

Notes:
  • a column name that do not begin with an underscore is processed by the default processor that saves the value in the R-store and forwards it to the next processor
  • a column name _<name> that is not a special column name is semantically equal to _hide|<name>

Example 1

10.sql=SELECT 'Hello world!' AS 'plain|_encrypt|encrypted|_hide'
10.10.sql=SELECT 'Plain text: {{plain:R}}<br>Encrypted text: {{encrypted:R}}'

produces
Plain text: Hello world!
Encrypted text: <encrypted>

Example 2

10.sql=SELECT 'Hello world!' AS message|_+p
20.sql=SELECT '{{message:R}}'

produces
<p>Hello world!</p>
Hello world!

Example 3

10.head=<ul>
10.tail=</ul>
10.sql=SELECT url FROM Link
10.10.sql=SELECT 'u:{{url:R}}|c:nicelink' AS '_link|_+li'

wraps links into li elements. This example does not work currently, because it is not allowed to specify more than one special column.

Example 4

10.head=<ul>
10.tail=</ul>
10.sql=SELECT encryptedValue AS '_decrypt|_+li' FROM data

displays a list of decrypted values.

Compatibility

This feature can be implemented in a way compatible with the current behavior.
  1. Currently only one special column (except _nowrap and _hide) is allowed and they are expected to be listed as first. These columns only affect the rendered content and not the value.
    • For a compatible behavior the value {{colname:R}} must be always the initial value, whereas the rendered value is {{&colname:R}}.
    • A more natural behavior would be to make {{colname:R}} the rendered value. How much would break with this change?
    • Note that {{&colname:R}} is obsolete as the same value can be obtained with {{colname.out:R}}. Removing &-values breaks compatibility.
  2. The behavior of _hide and _nowrap is unchanged - these processors are not expected to change the value of the column.
  3. A mixed behavior can be implemented with a special command to set the parsing mode (legacy or new).
Actions #1

Updated by Krzysztof Putyra 3 months ago

  • Description updated (diff)
Actions #2

Updated by Krzysztof Putyra 3 months ago

  • Description updated (diff)
Actions #3

Updated by Krzysztof Putyra 3 months ago

  • Description updated (diff)
Actions #4

Updated by Krzysztof Putyra 3 months ago

  • Description updated (diff)
Actions #5

Updated by Krzysztof Putyra 3 months ago

  • Description updated (diff)
Actions

Also available in: Atom PDF