Weekday problem

A newbie is askingIs there a way to show documents based on a view depending on what day of the week it is back to Sunday. ?

I have look at @Adjust but it does not make sense to me.

example

Workweek is Sunday through Saturday.

If today is Wednesday then you can view all the documents that were made on Sunday, Monday, Tuesday, Wednesday.

Or if today is Monday you would only view Sunday and Monday.

Also a view to just show the previous day.

There is no fixed date.

Most of the code I have looked at always needs a date to start from, but in this case it would always be the previous Sunday.

This is my code I am trying to use

SELECT Form = “Entry” & @If(@Weekday) =1;

@Adjust(@Now;0;0;-1;0;0;0);

@If(@Weekday) =2;

@Adjust(@Now;0;0;-2;0;0;0);

@If(@Weekday) =3;

@Adjust(@Now;0;0;-3;0;0;0);

@If(@Weekday) =4;

@Adjust(@Now;0;0;-4;0;0;0);

@If(@Weekday) =5;

@Adjust(@Now;0;0;-5;0;0;0);

@If(@Weekday) =6;

@Adjust(@Now;0;0;-6;0;0;0);

@If(@Weekday) =7;

@Adjust(@Now;0;0;-7;0;0;0)

Thanks for any help in advance !!!

Subject: RE: Weekday problem

The problem is that your selection expression has to return a boolean value (true or false). So let’s say you calculate a date using @Adjust – what about that date? You couldn’t just write:

SELECT @Today

because @Today isn’t true/false. You might write:

SELECT @Created = @Today

In your case, you want to select documents created on or after a particular date. I don’t know why you’re using @Now instead of @Today, but here’s an easier way to write the expression:

SELECT Form = “whatnot” & @Created >= @Adjust(@Today; 0; 0; 1-@Weekday(@Today); 0; 0; 0);

I would caution you, though, that if your application contains many documents, this will be slow. Especially if you’re never deleting the old documents, so that the number of documents in the application grows steadily over time, it will get slower and slower as the number of documents grows. For an explanation and alternatives, please read: Performance basics for developers (whitepaper) – which every novice developer should read anyway.

Subject: RE: Weekday problem

Sorry but I must ask, this one of line of code would replace what I had written ?

Thanks for your help

Subject: RE: Weekday problem

Yes; you might need to tweak it a little as it might be off by a day; read the description of @BusinessDays. Try it as a view selection formula to see what documents it would affect.

Subject: Weekday problem

Just rambling:

@Date(@Today)-@Date(@Created)/86400 <= (7-@Weekday(@Today))