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!

Filter on first 3 characters

Status
Not open for further replies.

Joe1010

Programmer
Dec 11, 2006
49
US
I would like to filter records where the first 3 characters start with xyz. What is the function for this?
Thanks
 
Go to Report->Selection Formula->Record and place:

{table.field} startswith "xyz"

Or you might create flexibility by creating a parametere and referencing the parameter in a wildcard:

{table.field} like {?MyParameter} +"*"

Now the user can enter what they want it to search for.

-k
 
It works only for text fields. I would like to use this for a number field where order_no starts with 543
Thanks
 
Cstr({table.field},0,'') like {?MyParameter} +"*"

beware that depending on your database this may not be passed as part of the generated SQL statement, so could be filtered locally and slow down teh report.

HTH

Gary Parker
MIS Data Analyst
Manchester, England
 
Create a SQL Expression which castc or converts it and then use the like pattern against the SQL Expression.

This will all be processed on the database.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top