Test for empty feild.

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
Wobble
Posts: 13
Joined: Sun Jul 28, 2019 4:38 am

Test for empty feild.

Post by Wobble »

Hi there,

How do I set up a conditional format for the following logic in my custom style.

if u20 is NOT empty output [[, otherwise output nothing.

Use case:

I am writing my own custom style to setup links back to Logos bible software resources when I create Logos personal books

FYI Logos personal books are a facility within logos software to add your own work to you logos library.

Logos references must be formatted as follows [[surface text>>Logos_Link]]. Note the initial [[

The surface text is the normal SBL format code.

I have set user20 to my Logos_link

So what I need is to test if u20 is empty, then either open with [[ if u20 has a value, otherwise do nothing.

{[[u20^ }a, t ~, ed. ~e | ~, trans. ~u3* ~, ~u2~ ed.~ ~, ~u13~ vols.~|~ ~ |~, ~j v` (`{u11;$ repr., $} |~; ~, l: u, d`)`>>u20@]]
[[https://ref.ly/logosres/jesusmideasteye?ref=Kenneth E. Bailey, Jesus Through Middle Eastern Eyes: Cultural Studies in the Gospels (Downers Grove, Ill.: IVP Academic, 2008)>>https://ref.ly/logosres/jesusmideasteye?ref=@@]]

but I need

[[Kenneth E. Bailey, Jesus Through Middle Eastern Eyes: Cultural Studies in the Gospels (Downers Grove, Ill.: IVP Academic, 2008)>>https://ref.ly/logosres/jesusmideasteye?ref=@@]]

Thanks in advance for your help
Jon
Site Admin
Posts: 10291
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Test for empty feild.

Post by Jon »

It would help enormously to simplify this format by (1) getting rid of ~ metacharacters unless they are essential (which is almost never) and if you need to guard against empty fields use $, and (2) build a small working example and then expand it. Your example is too complex for me to easily evaluate.

But looking at the beginning:

{[[u20^ }

I can tell you it means that if u20 has text, Bookends will output

[[u20 contents

and if not, output a space (there is a space after the ^).

The rest of the format isn't conditional, since you closed that with the } near the beginning.

As a result if u20 has content, it is output twice.

I think you want the entire format to be in a single conditional group. This is just an example, but something like this:

{[[u20, a, t $ed. $e...]]^[[a, t $ed. $e...]]}

Also note that I used $ rather than ~, because to me it's much easier to understand. But that's my preference and suggestion, you may prefer ~.

Jon
Sonny Software
Post Reply