1
votes

I need to add a default date value to a parameter in report builder 3.0 If today is monday then extract 3 day else extract 1 day. I have made an example in vb that works

If Weekday(Now(), vbMonday) = 1 Then

        TextBox2.Text = DateAdd("d", -3, Today())
Else
        TextBox2.Text = DateAdd("d", -1, Today())
End If

Now i want to do it in report builder, i tried following

=IFF (Weekday(Now(), vbMonday) = 1,DateAdd("d", -3, Today()), IFF(Weekday(Now(), vbMonday) != 1,    DateAdd("d", -1, Today()))

I am not familiar with the syntax in report builder when using if then else. can someone give me an example.

1
Why not add an extra column (MondayAdd?) to the SQL query and use CASE to return the result. You could then use this value in the report rather than resorting to the IIF? - MiguelH

1 Answers

2
votes

Try this:

=IIF(WeekDay(Now(),VbMonday)=1,
DateAdd("d", -3, Today()),
DateAdd("d", -1, Today())
)

You are using an unnecessary nested IIF to evaluate the false part of the outer IIF.