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

Query Question

Status
Not open for further replies.

nnaxor

Technical User
Mar 30, 2001
8
US
Hello. What I need to do is have a query that a user chooses an option from a drop down, i.e., A, B or C. That A B or C would coorelate to data in a field in the report which is what the query would be based on.

For example, I have a field that has A12345, A12346, B12347, C12348 etc. They need to choose which division they need A, B or C. However, they don't know the numbers and the letters are maningless so I want a drop down that says Apples, Berries, Celery and then based on that answer query by A12345 etc.

I hope this makes sense and someone can help.
 
I presume you are comfortable with writing the prompt to select "A" or "B" etc, so what you need is to use the "like" operater, called "matches pattern" in BO

You will need to include the response to the prompt in your query to generate SQL which looks something like this


Select column1, column2
From ATable
Where column1 like "A%"


This will return all rows in which column1 has data which starts with "A"

 
A slightly different approach would be to create an universe-object that only holds the first character from the codes you mention. This can be achieved by using a function like 'substr' on a new object of the database (actual function depends on RDBMS you are using) With such an object created (and the corresponding LOV) you can use this in a query condition or prompt. The list of values the user sees is than A,B,C, ........... T. Blom
Information analist
Shimano Europe
tbl@shimano-eu.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top