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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prompt values

Status
Not open for further replies.

1hrllabs

Technical User
Feb 21, 2005
19
0
0
US
Let me try anew with this question. I have a macro with two prompts. One prompt value is hard coded, second prompt value changes month to month. In the macro there a number of reports generated using the values of both prompts. Is there a way to identify the prompt value that changes month to month as "x" and then give "x" a value at the beginning of the macro script?
 
Sure. This is one of the reasons for calling reports from macros. When you have a series of reports run as a set, it is easier to just have a macro take the user input and then pass it to the reports. See FAQ401-2137 under the "Macros and Prompts" section for more details.

In terms of the hard coded prompt, I'm not sure why it's a prompt at all (if the value remains constant), but you can always set x to a value early in the macro, and then pass it along as part of the prompt string to each report.

Regards,

Dave Griffin


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Thanks, Dave. Could you tell me the script language for identifying "x". As for the hard coding, instead of writing 16 different reports for 16 orgs, I've made the org a prompted value/string.
 
I think I answered how to use "x" in your thread thread401-1018506 . Let me know if you have a specific question after you read that thread.

Dave Griffin

p.s. This kind of problem (answering in multiple threads all related to the same problem) is why TT discourages posting multiple threads on the same question.


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
I apologize for the poor TT etiquette. I have the macro working, but what I'd like to do is create a prompt within the macro to identify the value of x. The way the macro is written, I can open it up and change the value. However, I'd rather do this via a prompt. Suggestions? I've included a bit of the script. Thanks again for all your help.

Sub Main()
Dim x as string

x = "2"

Dim objImpApp As object
Dim objImpRep As Object
Set objImpApp = GetObject("CognosImpromptu.Application")
objImpApp.Visible True
objImpApp.OpenCatalog _
"s:\imp71_reporting_tools\BI04\Imp71_User\CATALOGS\Costpoint Catalogs\General Ledger.cat","Plan","hire1cop",,,1

Rem ****This is the beginning of the lab directors reports*******

rem ********ISSL*****************
Set objImpRep = _
objImpApp.OpenReport("s:\imp71_reporting_tools\joe's reports\green book\" & _
"03-ORG Calendarized GB.imr","30.2"+"|"+x)
objImpRep.RetrieveAll
objImpRep.Print
Set objImpRep = _
objImpApp.OpenReport("s:\imp71_reporting_tools\joe's reports\green book\" & _
"05-ORG OH Var.imr","30.2"+"|"+x)
objImpRep.RetrieveAll
objImpRep.Print
 
There are a variety of way to get user input into a macro. The one I use most often is the dialog function, using the dialog editor from within the macro editor. An easy alternative is to use the InputBox function:

InputBox Syntax:

InputBox[$]( prompt$ , [title$] , [default$] ,[xpos% , ypos%] )

Forgetting the xpos, ypos, which just determine where on the screen the box shows up, you need to use the other arguments, as in this example:

sub main
Dim Month
Dim msgtext
msgtext="Enter a month number (1-12):"
Month =InputBox$(msgtext, "Month Selector",1)
MsgBox "The month you entered is: " & Month
end sub

Just take the relevant portion of the code and stick it into your macro, replacing the constant x with the variable Month.

Give this a try and come back if you have questions.

Regards,

Dave Griffin




The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top