Page 1 of 1

Conditional literal string output based on additional field?

Posted: Fri Aug 15, 2014 12:21 pm
by MartinD
Hello,

I want to output different strings in the bibliography based on the language of the title. Thinking that a field could be used as a flag for conditional groups, somehow. Original(English):
a. (d). t `(`u3*~, Trans.~`).` ` In `e$ (Ed++.), $v `(`u2~ ed.~$, $~Vol. ~u14|~, p. ^, pp. ~p-`). `l: u`.`

If the User 8-field u8 contains e.g. 'English' (guessing that conditionals cannot be based on contents of a field) I want the above output. If it is empty I want(Swedish):
a. (d). t `(`u3*~, Översättn~`).` ` I `e$ (Red++.), $v `(`u2~ utg.~$, $~Vol. ~u14|~, s. ~p-`). `l: u`.`

Imagining conditional groups {Ed if u8'language flag'}{Red 'default as last group in chain if no other is used'} and corresponding chains for the others strings.

How would I go about achieving this?

Thanks,
Martin

Re: Conditional literal string output based on additional fi

Posted: Fri Aug 15, 2014 12:41 pm
by Jon
I think you've got it right, but realize that the contents of the "flag field" (u8 in this case) will be output. So if User8 contains the word "English", "English" will be output where you reference u8.

A nonsense example is

{u8 a^t}

where something like

English Smith, JA

would be output if u8 has the word English. And

The title of this work

would be output if u8 was empty.

I suppose that if the flag text were unique, you could do a find/delete for it after the scan was done.

Jon
Sonny Software

Re: Conditional literal string output based on additional fi

Posted: Sat Aug 16, 2014 10:49 am
by MartinD
Thanks!

This is what I ended up with(below is book instead of book chapter):
--u8 is English language flag, u20 is Swedish language flag.
--{u14 `unique catch all string`} needed to avoid nil object error if neither u2 or u3 has any content.
a. (d). t`(`{u8 `Trans. `u3` `^}{u20 `Översättn. `u3` `^}{u8 `ed. `u2` `^}{u20 `utg. `u2` `^}{u14 `unique catch all string`}`)`. l: u`.`

output with u20 set:
(Ahrne, Roman, & Franzén, 2008)
Ahrne, G., Roman, C., & Franzén, M. (2008). Det sociala landskapet : en sociologisk beskrivning av Sverige från 1950-talet till början av 2000-talet(uniqueSwedishLanguageFlag utg. 4 unique catch all string). Göteborg: Korpen.

Is this what you meant? It seems to work fine. Just a find and replace in the word processor after the scan.

Regards,
Martin

Re: Conditional literal string output based on additional fi

Posted: Sat Aug 16, 2014 5:53 pm
by Jon
Pretty much.

BTW, you should *never* get a nil object error. If you do, Rebuild your database and see if that helps. If it doesn't, please contact tech support directly and we'll figure it out.

Jon
Sonny Software

Re: Conditional literal string output based on additional fi

Posted: Sun Aug 17, 2014 7:49 am
by MartinD
After rebuilding the library the {u14 `unique catch all string`} group was not needed anymore.

Regards,
Martin