View Single Post
Old 12-20-2020, 06:25 PM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Wait for the next release, then:
  1. Convert the rules to advanced rules. You might want to duplicate them first. This will give you a rule that uses test(and...
  2. Create a new advanced rule containing a "first_non_empty() function.
  3. Copy the "test...and" lines and paste them as items in the first_non_empty in the order you want.
For example, given this advanced rule:
Code:
program:
test(and(
         strcmp(field('#enum2'), "no", '', '1', ''),
         strcmp(field('#enum3'), "no", '', '1', '')
    ), 'cry-icon.png', '');
the advanced rule with first_non_empty would be
Code:
program:
first_non_empty(
    test(and(
         strcmp(field('#enum2'), "no", '', '1', ''),
         strcmp(field('#enum3'), "no", '', '1', '')
    ), 'cry-icon.png', '')
)
If I (for example) add another branch to first_non_empty then it becomes
Code:
program:
first_non_empty(
    test(and(
         strcmp(field('#enum2'), "no", '', '1', ''),
         strcmp(field('#enum3'), "no", '', '1', '')
    ), 'cry-icon.png', ''),
    test(and(
         strcmp(field('#bar'), "no", '', '1', ''),
         strcmp(field('#flapjack'), "no", '', '1', '')
    ), 'foo.png', '')
)
chaley is offline   Reply With Quote