My approach to this is to use the @SetViewInfo([SETVIEWFILTER]; in the postOpen and queryClose events of the view. To do this, change your selection formula to:
Var := @If(@IsAvailable(ENVIADO); @If(ENVIADO != "Sim"; "Valido";"");"Valido");
SELECT (Form="Documento" & Emissor!="" & DocApagado="Não" &
Estado="Definitivo" & @IsUnavailable($Conflict) ) &
Var = "Valido"
Next add a column at the beginning of the view which is sorted and categorized. Give it this formula:
out := "";
@For(i:=1; i<7; i:=i+1;
wrkDt := @Adjust(Notes_Data; 0; 0; (i*-1); 0; 0;0);
tmp1 := @Text(@Year(@Date(wrkDt))) +
"-" + @Right("00" + @Text(@Month(wrkDt));2) +
"-" + @Right("00" + @Text(@Day(wrkDt));2);
out := @Trim(out : tmp1)
);
out
This will result in every document you want displayed on a given date appearing in the seven categories of the view for each date you would like it to appear.
If this is a web application you can then use RestrictToCategory setting to display just today's documents. If this is a Notes Client application, change the PostOpen event of the View to run formula code and set it to:view to
tmp1 := @Text(@Year(@Today)) +
"-" + @Right("00" + @Text(@Month(@Today));2) +
"-" + @Right("00" + @Text(@Day(@Today));2);
@SetViewInfo([SetViewFilter]; tmp1);
You will now see just the docs for today when you open the view. AND it will not constantly need to be refreshed.
NOTE: I use this text format to assure that this will work the same for any local date display format even when the server and the client use different formats.
One caveat... The SetViewInfo stays in effect for ALL views in the current database, so you should add to all the PostOpen events of views other than this one a formula which clears the value:
@SetViewInfo([SetViewFilter]; "");
Happy coding
/Newbs