Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

ID / Name label option for Filterbox #13398

Closed
durchgedreht opened this issue Mar 1, 2021 · 15 comments
Closed

ID / Name label option for Filterbox #13398

durchgedreht opened this issue Mar 1, 2021 · 15 comments
Labels
dashboard:native-filters Related to the native filters of the Dashboard enhancement:committed Enhancement planned / committed by a contributor

Comments

@durchgedreht
Copy link

Is your feature request related to a problem? Please describe.
In many DBs there's an ID / Name pattern. So the id is integer and name is String for human readable representation.
When using Filterbox you have to decide to use id field or String field, but ideally you'd like to use the id field for the technical filter and use the name for labelling only.

example table:

id name revenue
1 sports 1000
2 cars 3000
3 entertainment 20000

Benefits would be:

  • User still sees a list of Strings to include (as if he selected name)
  • preselecxt_fiter option could inject INTEGER values from the outside. This is especially useful from an integration perspective as normally APIs and applications that link directly into superset and want to preselect a filter will work on the ID rather than on the name
  • imagine the name is changed -this would break the 'contract' between the url parameters and the DB values. The argument, it's based on the data is very weak as names are considered dimension data and thus any data tool should rely on the ID field.

Describe the solution you'd like
It would be great to have an option 'verbose column' (or similar) in the filterbox's parameters. That column selection is optional, but would take care about the ID -> string mapping.

Screenshot 2021-03-01 at 23 51 10

In the UI filter box a user would just see values like 'sports', 'cars', 'entertainment', but it could be controlled by preselect_filter using IDs 1, 2, 3.
Screenshot 2021-03-02 at 00 02 26

Describe alternatives you've considered
If the 'verbose' field could be entered using a dedicated SQL expression potentially controlled/secured by some JINJA templating, that would maby more technical, but also more flexible.

@junlincc junlincc added enhancement:committed Enhancement planned / committed by a contributor dashboard:native-filters Related to the native filters of the Dashboard labels Mar 2, 2021
@junlincc
Copy link
Member

junlincc commented Mar 2, 2021

@durchgedreht thanks for suggesting. we included this item in 2021Q1 roadmap(tentative), but will mostly likely to implement the enhancement on the dashboard native filter, which is currently behind a feature flag.

@regisb
Copy link
Contributor

regisb commented Jun 1, 2021

Hi! I enabled dashboard native filters on my instance but did not see this feature. I also could not find a report about this feature in the related PRs:
#12148
#13591

Can someone please confirm that this feature is still on the roadmap? If yes, what's the corresponding ticket?

@jhult
Copy link
Contributor

jhult commented Aug 30, 2021

@junlincc and @suddjian,

Any news on this?

@danielsmeyer
Copy link

Is there a branch that I could checkout to get started on helping push this forward? @jhult @junlincc @suddjian
I have some time to get this integrated into the native filter.

@Eragra3
Copy link

Eragra3 commented Oct 5, 2021

Hello, this seems like a relatively simple feature, but would make a lot of stuff easier.

Is this item still on the roadmap?

@junlincc
Copy link
Member

Will pick it up, thanks for letting us know!

@amitmiran137
Copy link
Member

This got enabled in native filters and will not be addressed under filter box which is depracated already

@mathieudruart
Copy link
Contributor

@amitmiran137 Hello, do you know which version of superset enable this in native filters ? Thank you !

@amitmiran137
Copy link
Member

Probably 1.3.2

@mathieudruart
Copy link
Contributor

@amitmiran137 I'm using superset 1.3.2 but I can't figure how to do it, maybe I'm missing something ?

@nytai
Copy link
Member

nytai commented Jan 13, 2022

Reopening this issue as I does not appear to be solved. If I am mistaken could you please link a screenshot or PR so users are aware of how the feature works?

cc @amitmiran137 @junlincc

@nytai nytai reopened this Jan 13, 2022
@rusackas
Copy link
Member

rusackas commented Feb 7, 2022

From what I can tell, this was not built as part of the original Native Filters scope. We might be able to shoehorn it into some upcoming work around Native Filters, as it seems to me like a perfectly reasonable and useful feature addition. That said, it's more of a feature request than a bug report, per se, so I'm tempted to move this to the "Ideas" area of Discussions instead of its current state as an issue. Any objections to the move?

@villebro
Copy link
Member

villebro commented Feb 7, 2022

I can confirm this is not yet available. In a sense adding this feature isn't very difficult: The Select component already supports having different labels and values, and adding it to the filter component is relatively trivial. However, I'm more concerned with the following aspects of this feature:

  1. The native filter control panel has already grown way out of proportion, and we'd need to generalize it some more so that it would be more similar to the Explore control panel. I didn't yet check, but I fear adding this dropdown to the Value filter would require yet another if/then/else to the filter config modal.
  2. If the user chooses a combination of value and label columns that aren't 1-1 mapped, the user may get very strange behavior. To avoid confusing error states, we would probably need to verify that all value/label pairs are strictly 1-1.

I'm most concerned with 1), but as I haven't worked on this area for a while I'm not sure if this is a valid concern. @michael-s-molina , do you know if we could easily add an optional column label selector to the Value filter without adding more tech debt to the filter config modal?

@michael-s-molina
Copy link
Member

michael-s-molina commented Feb 7, 2022

@villebro We are currently working on stage 1 of the native filters design changes. The primary objective is to remove the old filter box at the end of this stage. I would advise including this requirement in stage 2 analysis where we'll probably refactor the whole module and your concerns will be addressed.

@villebro
Copy link
Member

villebro commented Feb 7, 2022

Thanks @michael-s-molina , that sounds like a good plan!

@apache apache locked and limited conversation to collaborators Mar 16, 2022
@zuzana-vej zuzana-vej converted this issue into discussion #19184 Mar 16, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
dashboard:native-filters Related to the native filters of the Dashboard enhancement:committed Enhancement planned / committed by a contributor
Projects
None yet
Development

No branches or pull requests