Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
en:create:filter-boolean [10.12.2014 15:05] – [Linking Multiple Conditions] alexander.ritteren:create:filter-boolean [07.12.2023 12:31] (current) – Nested Filters empschul
Line 192: Line 192:
 } else { } else {
   goToPage('end');   goToPage('end');
 +}
 +</code>
 +
 +===== Nested filters =====
 +
 +Sometimes it makes sense to set a filter in another filter. Let's take the situation where, depending on the answer to FF01, either question FF02 or FF03 was displayed. And now, depending on these two questions, another filter should follow. The individual filters would be simple:
 +
 +<code php>
 +if (value('FF02') == 1) {
 +  replace('%stimulus%', 'Dog');
 +} else {
 +  replace('%stimulus%', 'Cat');
 +}
 +</code>
 +
 +<code php>
 +if (value('FF03') == 1) {
 +  replace('%stimulus%', 'Wolf');
 +} else {
 +  replace('%stimulus%', 'Tiger');
 +}
 +</code>
 +
 +But now only one of these two filters should become active ... depending on which value FF01 had. To do this, these filters are placed "inside" another filter.
 +
 +<code php>
 +if (value('FF01') == 1) {
 +  // Filter für FF02
 +  if (value('FF02') == 1) {
 +    replace('%stimulus%', 'Dog');
 +  } else {
 +    replace('%stimulus%', 'Cat');
 +  }
 +} else {
 +  // Filter für FF03
 +  if (value('FF03') == 1) {
 +    replace('%stimulus%', 'Wolf');
 +  } else {
 +    replace('%stimulus%', 'Tiger');
 +  }
 } }
 </code> </code>
en/create/filter-boolean.txt · Last modified: 07.12.2023 12:31 by empschul
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
Driven by DokuWiki