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

Cognos Impromptu Macros

Status
Not open for further replies.

AHFMR

Programmer
Oct 26, 2003
13
I have a macro that reads data (LastName, FirstName) from a file. This data is used in the macro as prompt data. When I pass this into the report it breaks it at the comma. I under stand why that is happening. How can I use data that has a comma in the prompt data that is not a LIST.

i.e.
NamePrompt Type String

Data in the File
LastName, Firstname
FooLast, FooFirst
FooLast1, FooFirst1

Using Impromptu version 7.0.809.0

Any assistance is appreciated
 
AHFMR,
I'm a little uncertain as to whether your report requires two prompts or one.
If it is two prompts, you'll need to convert the comma into a pipe (the '|' character) so that impromptu 'reads' the string as two prompts. If one prompt, then convert the comma to a space.
lex


soi la, soi carré
 
If my recollection is correct, passing a single prompt value containing a comma is the way to pass multiple values to an IN clause multi-value prompt.

Not sure if that is what you are trying to do here.

Dave G.


The Decision Support Group
Reporting Consulting with Cognos BI Tools
Magic with Data [pc2]
Want good answers? Read FAQ401-2487 first!
 
Thanks for your responses.

drlex the report requires One prompt "Name". The format of the name in the DB is "Lastname, Firstname". Converting the comma to a space will not work because then you will find no matches in the DB.

griffindm you are correct passing a prompt in with commas is the way to pass multiple values to an IN clause.

There has to be a way to use a prompt that has a comma in it as a string.

 
If I am not mistaken, if you pass a single prompt containing a comma, and the filter using the prompt is just an equality (as in a type-in prompt), the prompt should work fine.

Are you saying this is not happening for you?

Dave G.


The Decision Support Group
Reporting Consulting with Cognos BI Tools
Magic with Data [pc2]
Want good answers? Read FAQ401-2487 first!
 
Yes that is what I am saying.

I have a type In Prompt (the only prompt for the report) and when I pass the data into the prompt it will cut it off at the comma. The data I am passing into the reports looks as follows

Smith, john
Smith, Joe


Below is the macro. It is straight forward. Opens a File reads names from the file, passes the names to the report the report run and saves the results to a pdf. When I am debugging the macro I verify the contents read from the file. The macro does work if I pass in a name that does not have a comma in it.



Dim ImpAppObject as Object
Dim ImpRepObject as Object
Dim ImpRepPDFObject as Object
Dim Name as string

Sub Main()

open "File with name " for input as #1

Set ImpAppObject = CreateObject("Impromptu.Application")
impappobject.visible TRUE
ImpAppObject.OpenCatalog "Catalog Loc and Name", "User","" ,"UserName", "Password"


While not(eof(1))
line input #1, Name

Set ImpRepObject = ImpAppObject.OpenReport("Report location and name",Name)

ImpRepObject.Activate
ImpRepObject.RetrieveAll
Set ImpRepPDFObject = ImpRepObject.PublishPDF
ImpRepPDFObject.Publish "Save File Location" & Name & ".pdf"
ImpRepObject.CloseReport

Set ImpRepObject = Nothing
Wend

ImpAppObject.Quit
Set ImpAppObject = Nothing

Close #1

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top