View Single Post
Old 04-10-2021, 07:11 AM   #503
Venia Legendi
Member
Venia Legendi began at the beginning.
 
Venia Legendi's Avatar
 
Posts: 13
Karma: 10
Join Date: Apr 2013
Device: lots of, frequently changing
Conditions / book_vars - maybe I'm on the wrong track?

Hello,

I want to differentiate actions depending on the title format type of the selected books. There are lots of different actions depending on this formats. The format types change quite often.

So I want to test the title format only once at the beginning, storing the result with set_book_vars('otyp', "Title Format Type") and then setting conditions on this book var.

This does not work for me and I fear I did not understand the concept of the book vars ...

I create a "Test" chain:

1st Action: "Chain Variable" OYTP with template
Code:
program:
otyp = switch(field('title'), 
	".*\s+\(\d\d\.\d\d\.\d\d\d\d\)\s*", "Zeitung", 
	".*\s+\(\d\d/\d\d\d\d\)\s*", "Zeitschrift",
	"Unbekannt");
set_book_vars('otyp',otyp);
book_vars('otyp')
2nd Action: "Single Field Edit" "#feltes1" → template
Code:
program:
book_vars('otyp');
with condition compared as text = Zeitschrift
Code:
program:
book_vars('otyp');
3rd Action: "Single Field Edit" "#feltes2" → template
Code:
program:
book_vars('otyp');
Fortunately the book variable "otyp" is set correctly, "#feltes2" shows the correct values, everytime.

Unfortunately the condition for "#feltes1" only works as expected if only one book is selected ...

You may find the chain export attached ...

P.S. Puha, that plugin definitely is more capable then my template skills
Attached Files
File Type: zip Chain Test.zip (617 Bytes, 557 views)
Venia Legendi is offline   Reply With Quote