Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompts

Status
Not open for further replies.

thabrane

Programmer
Aug 20, 2003
94
US
Hello,
is there any way to set up a prompt in Powerplay. I would like my users to be prompted for a date when they open my powerplay reports.
Any help would be helpful.
 
You will have to use a macro. Here is a sample that will help you get started. It opens a report and then gives you a drop down displaying levels to filter on. Then, it asks for a category to filter on. You could maybe hardcode the macro to the date dimension!?

good luck, flex.

Sub Main

Dim PPRep as Object
Dim objPDF as Object
Dim Options as Integer
Dim CatList as Object
Dim DimIndex as Integer
Dim DropListBox1() as String
Dim msgtext as String

'*** Opens report ***
Set PPRep = GetObject("D:\Prompted_report.ppr")
PPRep.Visible = True
PPRep.ExplorerMode = False

'*** Reads dimensions and creates DropList box ***
Options = PPRep.DimensionLine.Count
ReDim DropListBox1(Options - 1)

For x=0 to (Options - 1)

DropListBox1(x) = PPRep.DimensionLine.Item(x+1).Name

Next x

Begin Dialog UserDialog 186, 62, "Dimension Filter"
Text 8, 4, 42, 8, "Select Dimension:" , .Text3
DropListBox 8, 16, 95, 44, DropListBox1(), _
.DropListBox1
OKButton 124, 6, 54, 14
CancelButton 124, 26, 54, 14
End Dialog

Dim Dimension as UserDialog
On Error Resume Next
Dialog Dimension

'*** Sets selection to correct index value ***
DimIndex = Dimension.DropListBox1 + 1

'*** Dialog box to select category to filter ***
msgtext="Enter the category to filter on:"
FilterName=InputBox$(msgtext)

'*** Changes dimension ***
PPRep.DimensionLine.Item(DimIndex).Change(FilterName)

If Err=102 then
MsgBox "Dialog box canceled."
End If

'*** Save Report as ***
'*** 1 = PowerPlay Report
'*** 2 = MDC (multidimensional cube)
'*** 3 = ASCII or CSV (comma separated values)
'*** 4 = Excel Spreadsheet
'*** 5 = PowerPlay Portable Report
'*** Default: 1

objPPRep.SaveAs "MyNewReport",4

'*** Export to PDF ***
Set objPDF = objPPRep.PDFFile( "c:\Cognos\PDFSample" , True )

With objPDF
.SaveEntireReport = False
.SaveAllCharts = True
.AxisOnAllPages = True
.ChartTitleOnAllPages = False
.IncludeLegend = True
.SetListOfLayersToSave objPPRep.Layers

.SetListOfRowsToSave objPPRep.Rows
End With
objPDF.Save


End Sub
 
Thanks alot, flex. I hate to admit, but I'm new to macros and having trouble implementing it. Any suggestions to get me started. I would just like to run it with a report to see how it works, then I will decide if I want to hardcode it.
Thanks again.
 
Is this for use in Powerplay, or must it be used with upfront? I am looking to create a prompt which will work when opening a powerplay report.
 
How would I change it to a double drop down box instead of a dialog box? Can it be done? Thank You for any help.
 
Here is my current code. Everything works right except for the data in the second prompt. I can't get it to read from the dimension that is picked in the first prompt. It chooses the proper dimension to change in the report(I counted how many lines down), but it does not populate the dropdown properly.

Sub Main

Dim objPPRep as Object
Dim objPDF as Object
Dim Options as Integer
Dim CatList as Object
Dim DimIndex as Integer
Dim DropListBox1() as String
Dim DropListBox2() as String
Dim msgtext as String

'*** Opens report ***
Set objPPRep = GetObject("J:\Prompt Test.ppr")
objPPRep.Visible = True
objPPRep.ExplorerMode = False

'*** Reads dimensions and creates DropList box ***
Options = objPPRep.DimensionLine.Count
ReDim DropListBox1(Options - 1)

For x=0 to (Options - 1)

DropListBox1(x) = objPPRep.DimensionLine.Item(x+1).Name

Next x

Begin Dialog UserDialog 186, 62, "Dimension Filter"
Text 8, 4, 42, 8, "Select Dimension:" , .Text3
DropListBox 8, 16, 95, 44, DropListBox1(), _
.DropListBox1
OKButton 124, 6, 54, 14
CancelButton 124, 26, 54, 14
End Dialog

Dim Dimension as UserDialog
On Error Resume Next
Dialog Dimension

'*** Sets selection to correct index value ***
DimIndex = Dimension.DropListBox1 + 1

'*** Dropdown box to select category to filter ***
Options = objPPRep.DimIndex.Count
ReDim DropListBox2(Options1 - 1)

For x=0 to (Options1 - 1)

DropListBox2(x) = objPPRep.DimIndex.Item(x+1).FilterName

Next x

Begin Dialog UserDialog1 186, 62, "Category Filter"
Text 8, 4, 42, 8, "Select Category:" , .Text3
DropListBox 8, 16, 95, 44, DropListBox1(), _
.DropListBox2
OKButton 124, 6, 54, 14
CancelButton 124, 26, 54, 14
End Dialog

Dim Dimension1 as UserDialog1
On Error Resume Next
Dialog Dimension1

'*** Sets selection to correct index value ***
FilterName = Dimension1.DropListBox2 + 1

'*** Changes dimension ***
objPPRep.DimensionLine.Item(DimIndex).Change(FilterName)

If Err=102 then
MsgBox "Dialog box canceled."
End If



End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top