How to achieve sorting results in Report Definition, where values starting with search string comes first followed by values containing search string

How to achieve sorting results in Report Definition, where values starting with the search string comes first followed by values containing the search string.

For e.g.:

If the search string is peter against the company name column, the results should be in following order:

  1. PETER E. LAVINE, M.D.
  2. PETER F CHKOSKI MD
  3. PETER FERRARA MD
  4. PETER FILE DO
  5. A PETERS INC
  6. B PETER QUINN
  7. CALVIN R PETERS

@VINISHVINU

1.Create a custom sort order that prioritizes values starting with the search string.

2.In your Report Definition, add a new column (let’s call it “CustomSortOrder”).

3.Use an expression to assign a value of 1 to rows where the company name starts with the search string, and 2 to other rows.

4.For example, if the search string is “peter,” the expression could be:

IF(STARTSWITH(.CompanyName, “peter”), 1, 2).

5.Sort the report by the “CustomSortOrder” column in ascending order.

6.Sort by Company Name:

Next, sort the report by the actual company name column (e.g., “CompanyName”) in ascending order.

This will ensure that values starting with the search string appear first, followed by other values.

@VANAMAS16755149 Thanks for the solution!

I was able to achieve my requirement by using a Function Alias rule.

FunctionAlias_RD.docx (242 KB)

@VINISHVINU Thank you