Erro ArgumentError. The following actions/clauses are supported

Friends, have you passed through this?
What would be the solution?

Debug:

[info] GET /relatorios
[debug] Processing with GcallWeb.EcdrController.index/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] QUERY OK source="cdr" db=12.8ms
SELECT count('*') FROM `cdr` AS c0 []
[debug] QUERY OK source="cdr" db=0.3ms
SELECT c0.`calldate`, c0.`accountcode`, c0.`amaflags`, c0.`billsec`, c0.`channel`, c0.`clid`, c0.`dcontext`, c0.`disposition`, c0.`dst`, c0.`dstchannel`, c0.`duration`, c0.`lastapp`, c0.`lastdata`, c0.`src`, c0.`uniqueid`, c0.`userfield` FROM `cdr` AS c0 ORDER BY c0.`calldate` DESC LIMIT ? OFFSET ? [10, 0]
[debug] QUERY OK source="cdr" db=0.1ms
SELECT count('*') FROM `cdr` AS c0 WHERE (c0.`calldate` BETWEEN ? AND ?) [nil, nil]
[debug] QUERY OK source="cdr" db=0.2ms
SELECT c0.`calldate`, c0.`accountcode`, c0.`amaflags`, c0.`billsec`, c0.`channel`, c0.`clid`, c0.`dcontext`, c0.`disposition`, c0.`dst`, c0.`dstchannel`, c0.`duration`, c0.`lastapp`, c0.`lastdata`, c0.`src`, c0.`uniqueid`, c0.`userfield` FROM `cdr` AS c0 WHERE (c0.`calldate` BETWEEN ? AND ?) ORDER BY c0.`calldate` DESC LIMIT ? OFFSET ? [nil, nil, 10, 0]
[info] Sent 500 in 24ms
[error] #PID<0.1447.0> running GcallWeb.Endpoint (connection #PID<0.1445.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /relatorios
** (exit) an exception was raised:
    ** (ArgumentError) no function clause for GcallWeb.Router.Helpers.ecdr_path/2 and action :filter_cdr. The following actions/clauses are supported:

    ecdr_path(conn_or_endpoint, :create, params \\ [])
    ecdr_path(conn_or_endpoint, :delete, id, params \\ [])
    ecdr_path(conn_or_endpoint, :edit, id, params \\ [])
    ecdr_path(conn_or_endpoint, :filter_ecdr, params \\ [])
    ecdr_path(conn_or_endpoint, :index, params \\ [])
    ecdr_path(conn_or_endpoint, :new, params \\ [])
    ecdr_path(conn_or_endpoint, :show, id, params \\ [])
    ecdr_path(conn_or_endpoint, :update, id, params \\ [])
        (phoenix) lib/phoenix/router/helpers.ex:343: Phoenix.Router.Helpers.raise_route_error/6
        (gcall) lib/gcall_web/templates/ecdr/filter.html.eex:1: GcallWeb.EcdrView."filter.html"/1
        (gcall) lib/gcall_web/templates/ecdr/index.html.eex:3: GcallWeb.EcdrView."index.html"/1
        (gcall) lib/gcall_web/templates/layout/app.html.eex:21: GcallWeb.LayoutView."app.html"/1
        (phoenix) lib/phoenix/view.ex:399: Phoenix.View.render_to_iodata/3
        (phoenix) lib/phoenix/controller.ex:729: Phoenix.Controller.__put_render__/5
        (phoenix) lib/phoenix/controller.ex:746: Phoenix.Controller.instrument_render_and_send/4
        (gcall) lib/gcall_web/controllers/ecdr_controller.ex:1: GcallWeb.EcdrController.action/2
        (gcall) lib/gcall_web/controllers/ecdr_controller.ex:1: GcallWeb.EcdrController.phoenix_controller_pipeline/2
        (gcall) lib/gcall_web/endpoint.ex:1: GcallWeb.Endpoint.instrument/4
        (phoenix) lib/phoenix/router.ex:275: Phoenix.Router.__call__/1
        (gcall) lib/gcall_web/endpoint.ex:1: GcallWeb.Endpoint.plug_builder_call/2
        (gcall) lib/plug/debugger.ex:122: GcallWeb.Endpoint."call (overridable 3)"/2
        (gcall) lib/gcall_web/endpoint.ex:1: GcallWeb.Endpoint.call/2
        (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:33: Phoenix.Endpoint.Cowboy2Handler.init/2
        (cowboy) /home/gilberto/Projetos/elixir/gcall/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
        (cowboy) /home/gilberto/Projetos/elixir/gcall/deps/cowboy/src/cowboy_stream_h.erl:296: :cowboy_stream_h.execute/3
        (cowboy) /home/gilberto/Projetos/elixir/gcall/deps/cowboy/src/cowboy_stream_h.erl:274: :cowboy_stream_h.request_process/3
        (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
[info] Replied phoenix:live_reload :ok

Route:

get "/relatorios", EcdrController, :filter_ecdr

Controller:

  def filter_cdr(conn, params) do
    
    cdr = Structure.list_cdr()

    page = Structure.list_cdr
        |> order_by([c], desc: c.calldate)
        |> Repo.paginate(params)

    date_start = get_in(params, ["date_start"])
    date_end = get_in(params, ["date_end"])
    
    filter = Structure.list_cdr()
 
     |> where([c], fragment("? BETWEEN ? AND ?", c.calldate, ^date_start, ^date_end))
     |> order_by([c], desc: c.calldate)
     |> Repo.paginate(params)
      
    render(conn, "index.html", cdr: page.entries, page: page, page: filter)
  end

Based on this message, looks like your route is expecting :filter_ecdr but filter.html is passing :filter_cdr.

If that doesn’t fix it, it will be helpful to see the source of filter.html.

3 Likes

really was that,
total inattention.
Thank you for your help.

1 Like