BusinessObjects Board

How to Prompt for User Input and Add Document Variable

In Business Objects 6.1b, how do I prompt for the user to enter a value in the OnOpen Event and then add or modify a document variable, “NewRate”, to the document variable list so it can be used in creating other variables. I want the user to enter an Interest rate that can be used in a variety of calculations.

Thanks


denderoo (BOB member since 2004-06-23)

There are many options, but here is one:

Private Sub Document_Open()
    ThisDocument.DocumentVariables("New Rate").Formula = "= " & InputBox("Enter Rate")
End Sub

Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Thanks for that example. It does exactly what I need. I’m grateful that you kept it simple. Just the right level for me. :slight_smile:


denderoo (BOB member since 2004-06-23)

You are quite welcome!


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

I am encoutering a problem in BO 5.1.8

I need the prompt that allows the user to change the interest rate variable several times in the document, without rerunning the query.

I used the above Macro and tried closing and opening the document for each interest rate change but it does the calculation based on the previously entered prompt value rather than the current prompt value.

Please let me know if I am missing anything.

Thanks


ysarath (BOB member since 2006-08-03)

The example code is run only when the document is opened. If you need it to be “on demand” (triggered by the user), you’ll need to move the code to a custom menu button / macro instead.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Can someone please help me with the code for custom menu button / macro or direct me where to look for it.

I searched in the forum but could not find anything close.

Thanks


ysarath (BOB member since 2006-08-03)

I think the Intro to SDK guides have a section on menu items. Also check this utility. I know it includes menu / toolbar code.


Dwayne Hoffpauir :us: (BOB member since 2002-09-19)

Thanks Dwayne.

I am not good at SDK, but this could be a good chance to learn :slight_smile:


ysarath (BOB member since 2006-08-03)

Hello,

i attempted to use the above code as i need the user to be prompted to enter a month i.e. January which will then be used in other calculations within the report but i can’t get it work…

Runtime error 20: Cannot find the variable by its name

What am i doing wrong here? :hb:


mkouk (BOB member since 2006-07-03)