@dialogbox - Opening database

Hi There,

Question; I am using @dialogbox to open a form to display a Message or as “a notification” to users when they click on an action button. My question is … Can this code using @dialogbox be used the minute the user opens a database? I would like the user to see this message/notification before doing anything in the database. Any suggestions or comments are appreciated.

Thanks,

Jerica

Subject: RE: @dialogbox - Opening database

I see no reason you couldn’t run that in the Postopen event of the database script.

Subject: RE: @dialogbox - Opening database

Hello Andre,

I’ve tried to code it in the PostOpen event of the database script, but it seems to not work. I believe its because i’m using @dblookup (Needs to verify if the date is a holiday)

Here’s my code:

colMsgDate := @DbLookup(“”;“”;“(Holiday)”;datestat;1);

@If(colMsgDate = @Today);

@Do(

		@DialogBox("MsgCountry";[AutoHorzFit]:[AutoVertFit]: [NoCancel]:[ReadOnly] : [SizeToTable] ; "Checklist DB Notification" ) ;

		yn := @Prompt([YesNo]; "CHECKLIST DB" ; "Do you wish to create a New Checklist?");

		@If(yn = 1; @Command([Compose];"Turnover"); "")

		)

Subject: RE: @dialogbox - Opening database

There is NO PROBLEM using @DbLookup in a database script event. The places you can’t use @DbLookup are documented in the Designer help, and include things like view selection formulas, which must execute very fast for many documents.

“It seems not to work” is a little vague. What does it do instead of working?

Is this your entire formula? I’m looking at the first statement:

colMsgDate := @DbLookup(“”;“”;“(Holiday)”;datestat;1);

and it seems to me this will always return an error because you’re using a variable datestat that has no value.

@If(colMsgDate = @Today);

Your indentation suggests that you intended the lines following this to be part of an @If statement. However, you have closed your parens; the if statement is ended. The next lines are not in the @If.

@Do(

		@DialogBox("MsgCountry";[AutoHorzFit]:[AutoVertFit]: [NoCancel]:[ReadOnly] : [SizeToTable] ; "Checklist DB Notification" ) ;

I don’t understand what your intent is here, but I think you will want to use the [NONOTE] parameter since there is not a document to operate on here. Apparently you want to open a dialog using the MsgCountry form, but since you’re not checking the return value, it doesn’t matter whether the user presses OK or Cancel.

The article Debugging Domino Applications part 1 and part 2 contains tips for debugging your formulas. The first and most important things are to know the values of your variables, and to determine which parts of the formula are actually executing. @Statusbar is your friend. But you have to pay attention to the structure of the formula and not fool yourself with your own indentation.

Subject: RE: @dialogbox - Opening database

Thanks for your help Andre, I looked over my code, and it works. Thanks for also the extra tips!