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

Entering Multiple Values in a prompt

Status
Not open for further replies.

thatgirl100

Technical User
Oct 19, 2005
18
CA
Hi there,

Is there any possible way to be able to enter in multiple values in a prompt without using a picklist?

For example, I want the user to be able to enter in a FEW Doctor's License Numbers, but there would be way too many of these to create a picklist. Even if I could allow the picklist to have more than 100 values, I wouldn't want my user to have to scroll through such a long list.

I just want the use to be able to type in "60006, 60007, 60008" and have it look up all three.

Thanks for any help you can give me,
 
Assuming you are using impromtu, this was asked a few weeks ago

thread401-1131590

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
I'm using Impromptu. Thanks, I'll look at the old post.
 
Sorry Gary, but my Cognos support id has lapsed and I can't see if this is the solution given (nor can anyone else without a support id).

I would tackle this with either the position internal function or the instr function if available. Both look for a string within another string, and return a number based on whether the string is found, as in

Code:
  (start of filter) and instr(?prompt?,[i]rptcol[/i]) > 0 ...

For example, the user enters a prompt with value of
'1000/2000/3000/4000'
and the relevant values of the comparison col are '1000','1025','1050','2000','2500', and '4000'.

The report will only return '1000','2000', and '4000'.

Either the postion or instr function work with the same result, but the position often runs locally and the instr is only available if your database supports it.

Regards,

Dave Griffin



The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Hi Dave

I Hadn't thought about that, so I've now created a FAQ for future reference.

faq401-6080



Gary Parker
MIS Data Analyst
Manchester, England
 
Gary,
Surely Dave's method is easier and more versatile (probably faster too), as the character used as a separator in the prompt is irrelevant?

soi la, soi carré
 
drlex

wouldn't that method fall down if the user entered a prompt string of '100/200/300'

if the table contained values of 100,10,200,20,300,30

then all of these would be returned rather than just 100,200,300



Gary Parker
MIS Data Analyst
Manchester, England
 
Gary,
Point taken; I was testing with string values, and have previously found problems with nesting 'Postion' commands. Horses for courses, I guess [smile]

soi la, soi carré
 
Clarification,

The example assumes string values only. The delimiter is necessary. It works well with reference values of known and consistent length. It is not a panacea for all circumstances.

Dave G.


The Decision Support Group
Reporting Consulting with Cognos BI Tools
"Magic with Data"
[pc2]
Want good answers? Read FAQ401-2487 first!
 
Gary,

Thanks for the FAQ. It especially helps users that don't have access to the support site.

I met Trevor (the author of the original Cognos article) several years ago at a conference. Nice guy.

The technique he demonstrates is useful, but a bit complex for some end users. I just used a similar method with a macro last week to parse line input from a text file into multiple variables.

Thanks again for contributing to the FAQ area.

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