Fork me on GitHub
#re-frame
<
2020-03-26
>
ramonp.rios12:03:05

(defn get-brio-nr
  [db cust]
  (println "cust on db " cust)
  (get-in db [::ogm-search-results cust :brio-nr]))
I have a customer and i would like to get the :brio-nr of the same customer that i passed as paramenter into the get-in. I'm getting a null instead and i have no idea of how to make this work

pavel.klavik14:03:02

I think the problem might be with , which is the notation I find very confusing and do not use it. It adds the current namespace in front of the keyword. So maybe the data have a different namespace than the one in which this is called.

pavel.klavik14:03:56

In general, if you have a similar problem, I would debug all steps of this path in the data:

(js/console.log cust db (get-in db [::ogm-search-results]) (get-in db [::ogm-search-results cust]) (get-in db [::ogm-search-results cust :brio-nr]))

pavel.klavik14:03:17

Then you can see easily where is the problem.

ramonp.rios15:03:00

Thank you!! Let me check that

ramonp.rios12:03:23

Does someone could please give a insight?

ctamayo18:03:11

@ramonp.rios we can't really give you any more insights without seeing the data you're passing in (the value of cust and db). All I can tell you is that there is some mismatch between your code and the actual structure of the data.

ctamayo18:03:53

I would start by calling your get-brio-nr fn with some hard-coded data that you expect will return the right result. If you get an unexpected result, post the data here and we can try to help sort out the mismatch.