Subject: RE: Need help with @Adjust
Your problem is not with @Adjust.
You say, “When ValidDate have 30 or less days to @Now i want to send the mail.” You say “DDay is datefield with todays date.” The problem is that DDay does not contain today’s date. If it’s stored in the document, it contains whatever value was stored in the document when it was last edited (which might have been today’s date at the time, but probably isn’t today’s date anymore). If it’s not stored in the document, it will appear to contain “” (empty string). So when you compare with DDay, you aren’t comparing with today’s date.
If you want to compare a date with today’s date, use @Today in your formula.
Incidentally, you don’t seem to have gotten the point of a SELECT statement. Instead of:
SELECT @If((var1 <= var2); xxx; “”);
Use:
SELECT var1 <= var2;
xxx.
All those profile document lookups can then move below the Select statement, since you don’t need to do them unless you’re processing the document.
I know that in the Domino developer training, you were taught to create a dozen temporary variables for the arguments to your @Functions. Don’t do this, because:
It’s unnecessary extra typing.
It hurts performance.
It makes the formula harder to read because you can’t tell what the value of an argument is without looking at two different places in the code – and if the temporary variable assignments are far from the @Function, someone reading the code must scan all the intervening code to make sure they haven’t changed.
Because macro language lets you use an undeclared name anytime, it won’t warn you if the spelling of your variable name is different in the two places.
You may think you’re helping things by flagging your argument values with useful names, but this is only the case if your names match the arguments in the correct order. If you make a mistake – left one out or have them out of order, you’re just deceiving the reader and yourself with names that don’t mean the same as the arguments you provide, but that look correct.
It prevents you from easily seeing obvious errors such as the fact that the arguments to @Adjust are all zero, so that you might as well not be using it.