Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to add a rule based on comparison between columns? #2376

Open
pelord opened this issue Oct 27, 2023 · 5 comments
Open

Possible to add a rule based on comparison between columns? #2376

pelord opened this issue Oct 27, 2023 · 5 comments
Assignees
Labels
question Further information is requested

Comments

@pelord
Copy link

pelord commented Oct 27, 2023

Question

Is it possible to set a filter based on comparison between 2 properties

In this case, I try to style data based on a parent child relationship.
The base style for parent is a blue dot
The childs are not shown until a parent is clicked.

When I click on the parent, I set for every feature, the property _effectiveCondition based on the parent id.
Then, I want to style the childs based on the clicked parent..

      "filter": [
        "==",
        "_effectiveCondition",
        {{fieldContainingTheConditionToBeMet}}
      ]
@pelord pelord added the question Further information is requested label Oct 27, 2023
@jansule
Copy link
Contributor

jansule commented Nov 8, 2023

I'm not quite sure, I correctly understand what you are intending to do. Could you provide a minimal code sample or even some pseudo-code so that it becomes clearer to me?

@pelord
Copy link
Author

pelord commented Dec 15, 2023

Here the initial state:
image

If I click on one of these features, I set the column "valueToBeSetDuringAClickAction" with the content of the clicked feature (column value).

Here if i click on the feature with id =2

image

Here my question: Is it possible to filter values based on 2 columns, returning a true/false logic?

  "filter": [
    "==",
    "value",
    {{valueToBeSetDuringAClickAction}}
  ]

@jansule
Copy link
Contributor

jansule commented Jan 2, 2024

Thanks for providing more info @pelord.

So for the case you mentioned, you would like to compare the value of column value and the value of column valueToBeSetDuringAClickAction, right? So this would only return true for the row where id is 2.

This should be possible with following filter:

"filter": [
        "==",
        {
            "name": "property",
            "args": [
                "value"
            ]
        },
        {
            "name": "property",
            "args": [
                "valueToBeSetDuringAClickAction"
            ]
        }
    ],

Following PR and related issue might be interesting for you in that case: geostyler/geostyler-openlayers-parser#794 geostyler/geostyler-openlayers-parser#791

@jansule
Copy link
Contributor

jansule commented Jan 2, 2024

Please note that the UI cannot handle this currently. Also support for the different parsers might vary as well.

@pelord
Copy link
Author

pelord commented Jan 2, 2024

I will give a try to your exemple soon!
Thanks! You make my year 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants