I am trying to get Anki to only create a card if field A or field B is not empty. Delightfully, the only operations available to me to do this are testing if the field is present (#A[text]/), if the field is not present(^A[text]/), and nesting these conditions (#A^B[text]/). Interestingly, there is one sort of OR built into this system: #A[hello]/#B[world]/ will create a card if A is not empty OR B is not empty. However, I specifically need (A OR B)[hello]/ and the above will give me one of {∅, hello, world, helloworld} when I need to reduce it to {hello}.
-
$\begingroup$ Defining a new (logical) operation seems like fun! Is it what you're trying to do though? If A empty then if B empty then 0 else 1?! 🤔 $\endgroup$– Agent SmithSep 30 at 5:53
-
$\begingroup$ @AgentSmith I'm not sure where you are getting "If A empty then if B *empty then 0 else 1." If you are getting it from the (#A^B[text]/), that was just an example of notation. Also, is that "else 1" applying to the outer "if A empty" or the nested "if B *empty"? $\endgroup$– grepgrokSep 30 at 5:57
1 Answer
Of course, as soon as I post this, I find... a solution:
#A[hello]/#B^A[hello]/
However, this feels a little janky as this requires copying out the text twice which could become extremely unwieldy with significantly long texts.