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!

Select Expert (STARTSWITH)

Status
Not open for further replies.

ebstarasia

IS-IT--Management
Mar 9, 2011
62
US
I have a report that is selecting only file reference numbers starting with "CBO". However, since the turn of the new year, some files that are would normally be "CBO" are also now "CB" files. It use to be that there were two ref. no. to choose from, "CBO" & "CBA" making it easy to select which files to be used.

This may be something very simple that I am possibly making harder than it seems, but now I need to select data that start with "CBO" & "CB" but not any files that start with "CBA". Any suggestions?

Example of what the select expert has currently:
{T_OIMMAIN.F_RefNo} startswith "CBO
 
ebstarasia,

Just an idea, but would the following perhaps work in it's place?

Code:
(
   [blue]Left[/blue]({T_OIMMAIN.F_RefNo},2)="CB" [blue]OR[/blue]
   [blue]Left[/blue]({T_OIMMAIN.F_RefNo},3)="CBO"
) [blue]AND[/blue]
[blue]Left[/blue]({T_OIMMAIN.F_RefNo},3)<>"CBA"

Hope this helps!

Mike
---------------------------------------------------------------
"To be alive is to revel in the moments, in the sunrise and the sunset, in the sudden and brief episodes of love and adventure,
in the hours of companionship. It is, most of all, to never be paralyzed by your fears of a future that no one can foretell."
 
It will be enough to have just the CB part

Left({T_OIMMAIN.F_RefNo},2)="CB"
AND
Left({T_OIMMAIN.F_RefNo},3)<>"CBA"


Left({T_OIMMAIN.F_RefNo},3)="CBO" will be covered by left({T_OIMMAIN.F_RefNo},2)="CB"


If you want to continue to use the CBO-CBA parameter you can add it to the selection formula:
(
{?Parameter}="CBO" AND
Left({T_OIMMAIN.F_RefNo},2)="CB" AND
Left({T_OIMMAIN.F_RefNo},3)<>"CBA"
)
OR
(
{?Parameter}="CBA" AND
Left({T_OIMMAIN.F_RefNo},3)="CBA"
)

If the report is slow you may decide to use SQLExpression. As it is now all records will be downloaded locally and filtered by the record selection formula. If you switch to SQLExpression the filtering will be done in the database

Viewer, scheduler and report manager for Crystal reports and SSRS.
Send your report everywhere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top