- Issue created by @abx
- 🇩🇪Germany jurgenhaas Gottmadingen
The best way to do that is using a view, where you can forward your search values from the ECA action Views: Execute query and build the SQL query as complex as it's required in the views UI.
Yes, I thought about that after post this question, and I actually working in Views which seem to work ok except I have problem with Contextual filters. What should I use there as a filter?
When I choose " Provide default value" -> "Content ID From URL". With multiple Filters, it works fine in Preview but it's not when I do it through ECA.
I'm wondering what should I use in Contextual filters?
Thank you,
- 🇩🇪Germany jurgenhaas Gottmadingen
"Provide default value" is correct, then use "Raw value from URL" as the type and select the "Path component" number starting from 1 up to 10. Each argument that you forward to such a view is then one of those raw values.
I did a few tests and found something strange.
To make multiple arguments to work, I have to set all "Contextual filters" -> "Path component" as 1.
Then, in ECA, "Arguments" has to be in this format [argument1]/[argument2]/[argument3]/[argument4]
If I put Arguments line by line in ECA as below:
[argument1]
[argument2]
[argument3]
[argument4]Then, set all "Path component" to 1. OR set "Path component" to 1, 2, 3 and 4 to match arguments in ECA. The result show is incorrect.
- 🇩🇪Germany jurgenhaas Gottmadingen
We have at least a mismatch of form field description and functionality:
The form field description states that there should be one argument per line. But the implementation expects the
/
separator. I'd prefer the line break TBH and I think we should fix the implementation part.For the rest of the issue, i.e. how to provide multiple arguments and make them work properly, I need to build a test view before I can confirm that this is a bug.
- 🇩🇪Germany jurgenhaas Gottmadingen
@abx I've now had a chance to test this and it works as expected. I have 2 contextual filters, the first one uses the raw value 1 from URL and the second uses the raw value 2 from URL. In ECA I define the arguments field as
value1/value2
and that is being used as an AND condition in the SQL query then. The query results are as expected.That leaves the UI aspects for the arguments field in ECA. The description states this:
Provide the Contextual filters of the view in order and one by line.
But what's expected is a single line with
/
as the separator. I would actually prefer the line break, as mentioned above. But changing that now would break things. Therefore, we may have to live with the slash separator but should make 2 changes:- Change the field description
- Change from a text area to a text field
From what you said, I did some more test and found that value in "Path component" doesn't matter too. I tried to set "Path component" to 1 for all arguments. Or I can just set one of them in different order like 1, 7, 1, 1. The result I got is the same. The important thing here is the order in the "Contextual filters". It has to match to the argument passing to.
About making those 2 changes, that would be great. Without a correct description, lots of people will try it without success.
Thank you,
- Assigned to jurgenhaas
- 🇩🇪Germany jurgenhaas Gottmadingen
That's reasonable from a technical point of view, but of course, confusing to users. I suggest that we provide a context filter plugin from ECA that declares a context filter default value being for ECA and not requiring a display handler that comes with a path. That way, we can explain that you can add any number of context filters for ECA where just the order of those filters is relevant on how they get filled when executed by the ECA action.
- @jurgenhaas opened merge request.
- Status changed to Needs review
over 1 year ago 11:13am 13 April 2023 - 🇩🇪Germany jurgenhaas Gottmadingen
Implemented the 2 changes from #7 and also provided an argument_default plugin called
ECA
which can be used in the contextual filter setup, when no further specification is required as we only care about the order of arguments: - Status changed to RTBC
over 1 year ago 3:10pm 13 April 2023 Thanks jurgenhaas,
Just tested patch #11 and it works as expect. No more option in Contextual filter to confuse user.
-
jurgenhaas →
committed c07034f3 on 1.2.x
Issue #3351738 by jurgenhaas, abx: "Entity : Load" with multivalue...
-
jurgenhaas →
committed c07034f3 on 1.2.x
- 🇩🇪Germany jurgenhaas Gottmadingen
Thanks for your feedback, have merged this into 1.2.x
- Status changed to Fixed
over 1 year ago 3:29pm 27 April 2023 Automatically closed - issue fixed for 2 weeks with no activity.