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

Metric with unnamed Custom Expression breaks Data Model for table #10844

Open
flamber opened this issue Sep 9, 2019 · 0 comments

Comments

@flamber
Copy link
Contributor

commented Sep 9, 2019

Describe the bug
Create a Metric with a Custom Expression without giving it an optional name, and then save the metric and visit Data Model. Now it doesn't load the data on the table for the metric.

Logs
I'm not seeing any backend errors.
But there's browser errors. While saving the Metric it gave TypeError: prevComponentInstance is null.
And when visiting the Data Model, then it shows Error: `query` is a required parameter to format expressions.

To Reproduce

  1. Go to Admin > Data Model > Sample Dataset > Orders > Add a Metric
  2. Click View > Custom Expression and set expression Sum(Subtotal) + Sum(Tax) without setting Name, click Done.
  3. Save expression (it might be "stuck" and need a second click on Save). Browser console should show TypeError: prevComponentInstance is null.
  4. If it returns to the Data Model (Sample:Orders), then there's no data/metrics/column and browser console shows Error: `query` is a required parameter to format expressions

Work-around
Manually go and edit the Metric and give the Custom Expression a name.
Visit the URL /admin/datamodel/metric/X, where X is the ID of the failing metric.
If you don't know the ID of the metric, but it was the last metric created, then create a working metric on another table (i.e. Sample Dataset) and check the ID in the URL.

Information about your Metabase Installation:
Metabase 0.33.2 (and 0.33.0 and current master) on H2 with various browsers.

Additional context
Was reported in the forum:
https://discourse.metabase.com/t/custom-expression-in-metric-crashing-the-model/7285

@flamber flamber added the Type:Bug label Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.