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:
- PETER E. LAVINE, M.D.
- PETER F CHKOSKI MD
- PETER FERRARA MD
- PETER FILE DO
- A PETERS INC
- B PETER QUINN
- 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)