BusinessObjects Board

Prompt that default to ALL

Hi everyone,

I am trying to add a prompt as part of the condition of my report. I like this prompt to default to ALL (list of values). At the same time, user can override this default to ALL and type in a value.

Please advise how I can do this… thanks!

:slight_smile:


mhuynh (BOB member since 2002-10-23)

In brief:

BO does not provide default values for prompts (you might be able to do something using VBA).
Please, look at FAQ: Designer


Andreas :de: (BOB member since 2002-06-20)

It is simple - you just have to write a small VB script
Follow these steps after your report is created:

  1. Go to Tools->Macro->Visual Basic Editor
  2. Then Click on View-> Code – an empty screen will popup put the script below in it & customize according to the prompts in the report.

Sub Document_Open()
Dim MyVar As Variable
Set MyVar = Variables.Item(“1.Department”)
MyVar.Value = “ALL”
Set MyVar = Variables.Item(“2.Category”)
MyVar.Value = “ALL”
Set MyVar = Variables.Item(“3.Start Date”)
MyVar.Value = DateAdd(“d”, -1, Date)
Set MyVar = Variables.Item(“4.End Date”)
MyVar.Value = DateAdd(“d”, -1, Date)
End Sub

*Note: a)Make sure you put the exact Prompt name within double quotes
b) The date value given above will default the previous day (-1).

  1. Click blue button on top (Run Sub/User Form) to execute the macro.
  2. You can test the default prompt by clicking the refresh button of the report and see ALL appearing in the prompt you specified.

This macro will run whenever the document is opened

Enjoy
Samrat


samrat (BOB member since 2002-08-28)

If you are talking about Full Client Reports, you can go to the query panel for your dataprovider and click the Option button in the bottom left side of the screen. Under Partial Results, click the radio button for Other. Type 0 in the textbox. Click OK. Click Run. When the prompt box(es) pop up, fill in with your default value and click OK. A little box will pop up that says you have chosen 0 rows Click OK. You’ll get the no data to fetch box. Click OK again. Save the report. The next time you refresh you’ll get the default value prepopulated in the prompt textbox and you’ll get all the values returned. Obviously, if you want to use ALL you have to set up your condition to allow the ALL. But I use this on many of my reports. The users love it. It even works if the full client reports are refreshed in Webi.
Hope it helps.
Joanne


Joanne (BOB member since 2002-07-10)

Thankyou all for your reply.

I tried all suggested and in the process of testing Joanne suggestion at the moment. I can’t seem to get the earlier suggestions working. The @prompt solution in desginer gave me syntax error (i checked and checked but no go). The VBA otion doesn’t seem to give me the prompt.

Joanne, your suggestion gave me exception error. Not sure what I am doing wrong.

I am going to try these again.

Cheers… :crazy_face:


mhuynh (BOB member since 2002-10-23)

You can set this up a “default answer” for reports that are constantly downloaded from the repository, but if they are saved, they will take the last values they were assigned when refreshed.

You will need to look up have “ALL” values in a prompt. If you have a report prompt established already, then you can:

[list]
Change the Option to “Do not return Data”.
Refresh the report, but answer with “ALL”
Edit the Data Provider (through the Data Manager)… setting it back to return data.
Save the report (or export it).
[/list]

Now each time the report is opened or imported, it should contain the “ALL” prompt.


digpen :us: (BOB member since 2002-08-15)

Thanks digpen.

However, I like the report to always default to “ALL” even when they’re saved.


mhuynh (BOB member since 2002-10-23)

In which case, there is nothing out of the box that would allow for this. You might be able to change the value of the “UserResponse” via VBA, but that’s normally frowned upon. Especially if you use the UserResponse values to feed Report Header information.

You’d have to write the VBA to occur AfterEdit and BeforeRefresh. Beware that this may crash unless you also have the code ensure that this condition is always present as well.

-RM


digpen :us: (BOB member since 2002-08-15)

digpen, thanks again.

This is also another good option but as you’ve have stated;
“Beware that this may crash unless you also have the code ensure that this condition is always present as well”
So in terms of cost effective, the stakeholder might be shy from spending the extra money. I guess this is where I will present what options available and let the stakeholder decide.

Cheers.


mhuynh (BOB member since 2002-10-23)