Call Function with Field Filters


#1

Dear Metabase Family.

I am calling a function out of Metabase using Native Querry which triggers some inserts into a data table.
This looks like:

  • select trasferta({{plant}}, {{start_date}}, {{export}}) from dual

In addition to that, I want to show the user on the same dashboard the outcome of above question (returns error or success) and show him the source table where the insert has been made. So the user can check if the data are ok or not.

In order to avoid errors I want to give the user the possibility to select {{plant}} and {{export}} from a dropdown list.
Therefore I created 2 Tables:
Table 1 with entries:
Plant1
Plant2
Plant3

Table 2 with entries:
N
Y

Before I went into detail I executed the select using “normal” filters with variable type text. This worked fine. Also when executing the select on the database everything is working fine: e.g.select trasferta(‘Plant1’, 20181130, ‘N’) from dual

Then I put as variable type “field filter” and bound {{plant}} to Table 1 and {{export}} to table 2.
In “Filter widget type” I selected Category in order that the drop down shows as filter in the question (and it can be connected afterwards to the dashbaord filter when adding to the dashbaord).

But unfortunately i get an error:
java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis

I tried everything but didn’t solve the Problem. Can somebody help?

Error message in Logs is:
Query failure: java.sql.SQLSyntaxErrorException: ORA-00907: missing right parenthesis

(“clojure.core$ex_info.invokeStatic(core.clj:4739)”
“clojure.core$ex_info.invoke(core.clj:4739)”
“–> query_processor$assert_query_status_successful.invokeStatic(query_processor.clj:285)”
“query_processor$assert_query_status_successful.invoke(query_processor.clj:277)”
“query_processor$run_and_save_query_BANG_.invokeStatic(query_processor.clj:323)”
“query_processor$run_and_save_query_BANG_.invoke(query_processor.clj:316)”
“query_processor$fn__37661$process_query_and_save_execution_BANG___37666$fn__37667.invoke(query_processor.clj:354)”
“query_processor$fn__37661$process_query_and_save_execution_BANG___37666.invoke(query_processor.clj:340)”
“api.card$run_query_for_card.invokeStatic(card.clj:580)”
“api.card$run_query_for_card.doInvoke(card.clj:566)”
“api.card$fn__46963$fn__46966.invoke(card.clj:587)”
“api.card$fn__46963.invokeStatic(card.clj:586)”
“api.card$fn__46963.invoke(card.clj:582)”
“middleware$enforce_authentication$fn__56091.invoke(middleware.clj:113)”
“api.routes$fn__56237.invokeStatic(routes.clj:62)”
“api.routes$fn__56237.invoke(routes.clj:62)”
“routes$fn__56326$fn__56327.doInvoke(routes.clj:108)”
“routes$fn__56326.invokeStatic(routes.clj:103)”
“routes$fn__56326.invoke(routes.clj:103)”
“middleware$catch_api_exceptions$fn__56226.invoke(middleware.clj:436)”
“middleware$log_api_call$fn__56204$fn__56206.invoke(middleware.clj:364)”
“middleware$log_api_call$fn__56204.invoke(middleware.clj:363)”
“middleware$add_security_headers$fn__56146.invoke(middleware.clj:252)”
“core$wrap_streamed_json_response$fn__62590.invoke(core.clj:67)”
“middleware$bind_current_user$fn__56096.invoke(middleware.clj:137)”
“middleware$maybe_set_site_url$fn__56156.invoke(middleware.clj:290)”
“middleware$add_content_type$fn__56149.invoke(middleware.clj:262)”)

Lukas