BRW OnOpen script (Banded Report Writer)
At 02 JUN 2020 01:45:32PM Jim Vaughan wrote:
One of my co-workers, just asked me this, any ideas anyone?
I have a BRW question. I am adding prompts to some of our reports (for example prompting whether to show the detail or summary report). I have a prompt (VB MsgBox) in the script property OnOpen.
When I run the print preview in BRW the prompt works as expected. However, when we run the report from our menus using RTI_BRW_Generatereport with UseGUI = 2, I receive the prompt two times and I am not sure why.
Is there some way to receive this prompt only once, either by using a different property or by some change to our call to RTI_BRW_Generatereport?
Jim R Vaughan
At 03 JUN 2020 09:04AM bshumsky wrote:
One of my co-workers, just asked me this, any ideas anyone?
I have a BRW question. I am adding prompts to some of our reports (for example prompting whether to show the detail or summary report). I have a prompt (VB MsgBox) in the script property OnOpen.
When I run the print preview in BRW the prompt works as expected. However, when we run the report from our menus using RTI_BRW_Generatereport with UseGUI = 2, I receive the prompt two times and I am not sure why.
Is there some way to receive this prompt only once, either by using a different property or by some change to our call to RTI_BRW_Generatereport?
Jim R Vaughan
Hi, Jim. I haven't seen this behavior, but then again, the only prompting I've really tested has to do with the "comparison value" prompting (using the syntax "?Prompt?" in the selection criteria). So I don't have an explanation. By the way, does it make a difference if you answer the first and second prompt differently? Which one does it listen to - the first one? Or the second one?
Just as a potential work around (that I can't test at the moment) - maybe you can find a global variable that has been set, or that you can set, that indicates whether the prompt has already been displayed? And then NOT show the MsgBox if that variable is already set? So, try looking at, say, the built-in PAGE or PAGES variable, and see if they are different in the two instances?
It might even be possible to call an OI stored procedure/function to determine if the MsgBox should be displayed - the BRW has the ability to call an OI function. Perhaps you can write a function that takes a value, like the report name, and returns a 1 or 0 - and in the function, you can check a record or a common variable to see if the report has called the function previously (return 0) or if this is the first time (return 1, and set the "already been called" flag for the next go-round)…
Again, these are all untested, but they might give you some ideas on what you can try. Let us know what you find out, and what ends up working (if any) for you?
- Bryan Shumsky
At 03 JUN 2020 01:03PM Jim Vaughan wrote:
Thanks for the suggestions, I will get back to you.
Jim R Vaughan