Cannot Define Multiple Values for Dashboard Content Process Parameters

Description

Issue: multi-selection parameters are not supported in Dashboard Content -> Process Parameter field. Defining e.g. C_BPartner_ID=200000,117,50003 (comma separated) throws parsing error, and C_BPartner_ID=200000;117;50003 (semicolon separated) recognises it as a range parameter between 200000 - 50003.

New syntax for defining multi-selection: C_BPartner_ID=”200000,117,50003” as suggested by Carlos

Environment

None

Activity

Show:

Peter TakacsMarch 29, 2023 at 2:13 PM
Edited

I see, I thought the ‘s' in your example C_BPartner_IDs=”200000,117” would be part of the syntax So if it is really just ColumnName=”ID1,ID2” than I must remove that part of the code

Carlos RuizMarch 29, 2023 at 2:05 PM

- I think the quoting solution is more elegant and clear, just thought you haven’t developed it yet and quoting sounds easier, but if is already done I think quoting is OK.

 

About the pull request, you’re hardcoding the column ending with “IDs” - but that’s a very difficult assumption, the multi-selection columns can have any name, why do you need to remove the last “s” ?

Peter TakacsMarch 29, 2023 at 1:49 PM
Edited

Hi team, thank you for the suggestions, I’ve already prepared a PR for the quoting solution. But even after reading heng sin’s idea of the escape character, quoting sounds as a better, more sophisticated option to me, and the logic could be improved/reused later nicely. wdyt?

Carlos RuizMarch 29, 2023 at 1:40 PM

I guess another option is to escape it, i.e something like QtyOrdered=10;50,C_BPartner_IDs=200000\,117

That’s right, escape sounds simpler to develop than quoting

Heng Sin LowMarch 29, 2023 at 1:12 PM

I guess another option is to escape it, i.e something like QtyOrdered=10;50,C_BPartner_IDs=200000\,117

Carlos RuizMarch 29, 2023 at 10:20 AM

So, at this moment we have this:

  • Sets of parameter=value separated by comma “ , “

  • Within the value we have ranges separated by semicolon “ ; “

 

That has been there since adempiere times, so is very possible that people are using it.

 

I think a more natural approach could be to allow quotes in the value part, anything within quotes becomes part of the value, even commas.

So, your example would look like:

QtyOrdered=10;50,C_BPartner_IDs=”200000,117”

or it can be written in the other way too:

C_BPartner_IDs=”200000,117”,QtyOrdered=10;50

 

To do this I think the only change required is in MDashboardContent.parseProcessParameters - somehow like extracting the quoted parts of the String before splitting the commas

We have something similar using regular expressions to extract the quoted parts in Convert.replaceQuotedStrings, so that can be a starting point, but I think maybe we don’t need all the complexity of Convert - just extract the quotes and then replace them again when converted.

Nicolas MicoudMarch 29, 2023 at 5:10 AM

Hi,

Some thoughts

What about rethinking separators?
Parameter separator could become ; (or &)
Range separator could become | (or &)
So we could write something like

C_DocType_ID=116;DateAcct=@SQL=SELECT SYSDATE - 30 FROM DUAL|@SQL=SELECT SYSDATE FROM DUAL;C_BPartner_ID=IN(1000123, 1000124)

A migration script and/or a migration note can help implementors to update their existing dashboards (I don’t think there is a lot out there)

 

Otherwise, suggestion (less disruptive) could be improved (easier to read) to something like
QtyOrdered=10;50 : range
C_BPartner_ID=(200000;117) : multi-selection

Peter TakacsMarch 28, 2023 at 2:11 PM

My question is, what character should we use as separator for multi-selection values? Currently ‘,' separates the parameters and ';’ separates range values. Would it be correct to reuse the ‘;' character? This way e.g. QtyOrdered=10;50 would mean range, but C_BPartner_ID=200000;117 could mean multi-selection.

Norbert BedeMarch 28, 2023 at 1:58 PM

hi. original contributor and help us if i remember too with this process implementation. somehow we need escape it ?

Peter TakacsMarch 28, 2023 at 1:50 PM

Hi , what do you think about the suggested solution in the description, would it work?

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created March 28, 2023 at 1:47 PM
Updated June 1, 2023 at 12:17 PM
Resolved April 5, 2023 at 11:00 AM