You Can View User Feedback To This Tip
Some view selection formulae can be very complicated:
This and that, or that an this but only
when it is the 7th friday in April etc.
It is possible to simplify this considerably (to read anyway) by using an @If statement and @True; @False.
Unlike in normal circumstances where @if take the first true statement and ends - in the view selection formulae it takes ALL statements and bases the selection on them ALL.
Here is a small example but it can be expanded as much as you like. I have tried to keep the example as simple as possible but with this method you can embed @Ifs and it should still be quite readable.
Code
SELECT
(Form="Form1") | (Form="Form2" & AddDate>@Adjust(@Today; 0; 0; -30; 0; 0; 0)) | (Form="Form3" & AddDate>@Adjust(@Today; 0; 0; -7; 0; 0; 0)) | (Form="Form4" & AddDate>@Adjust(@Today; 0; 0; -7; 0; 0; 0))
Can be rewritten as
SELECT
@If(
form = "Form1"; @True;
form = "Form2" & AddDate>@Adjust(@Today; 0; 0; -30; 0; 0; 0); @True;
form="Form3" & AddDate>@Adjust(@Today; 0; 0; -7; 0; 0; 0);@True;
form="Form4" & AddDate>@Adjust(@Today; 0; 0; -60; 0; 0; 0); @True;
@False)
USER FEEDBACK TO THIS TIP