This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-14
Channels
- # adventofcode (12)
- # aleph (8)
- # announcements (6)
- # babashka (16)
- # beginners (217)
- # biff (7)
- # calva (30)
- # chlorine-clover (4)
- # cider (3)
- # clj-kondo (15)
- # cljdoc (6)
- # clojure (50)
- # clojure-europe (86)
- # clojure-finland (2)
- # clojure-nl (1)
- # clojure-norway (37)
- # clojure-uk (2)
- # clojurescript (8)
- # cursive (10)
- # datomic (13)
- # emacs (1)
- # fulcro (41)
- # helix (1)
- # humbleui (2)
- # joyride (7)
- # juxt (4)
- # lsp (19)
- # off-topic (47)
- # pathom (14)
- # polylith (5)
- # portal (7)
- # reagent (10)
- # releases (4)
- # sci (1)
- # scittle (18)
- # shadow-cljs (54)
- # test-check (2)
- # tools-deps (28)
Hello! This query works, but only if I have some status attached to the entity. Is there a way to get some defolt value for transaction and it's attribute if status wasn't set to an entity?
(d/q '[:find ?e ?status ?last-tx ?caused-by
:in $ [?e ...]
:where
[?e :encounter-transmission/plan]
[(get-else $ ?e :encounter-transmission/status false) ?status]
[?e :encounter-transmission/status ?status ?last-tx true] ;; empty ?last-tx here if ?status = false by get-else
[(get-else $ ?last-tx :transaction/caused-by false) ?caused-by]]
.....)
Unfortunatelly looks like I can't call get-else
on pre-last where clauseActually I'm pulling ?e, just tried to show you simple example. But anyway, even if I pull ?e, how can I access last transaction which added status attribute (if it was added at all)?
Cause I cant call get-else with 5 or 6 parameters May you show how I can use it for pre-last clause in my query?
you can either write your own get-else, or use a rule with two branches: one that matches if status is absent, and one if its present, and both bind to ?last-tx