crystal formula used to group

Stimulsoft Dashboards.WEB discussion
Post Reply
jgoswalt
Posts: 3
Joined: Mon Feb 10, 2020 4:40 pm

crystal formula used to group

Post by jgoswalt » Mon Feb 10, 2020 5:47 pm

I have a formula that I have from a crystal report. Basically I have a database field that contains FirstName a space and LastName. I want to parse this field to get the last name and then use that to group/sort the report. This code is in a crystal formula called SortEmpLName. I then group the report on this field. Below is the original crystal code. How do I do this is Stimulsoft?


global stringvar lname:= "";
local numbervar i;

for i := Length ({AttendSumm.EmplName}) to 1 step -1 do
(
if Mid ({AttendSumm.EmplName},i ,1 ) = " " then
(
lname:= Mid ({AttendSumm.EmplName},i+1 ) + ", " + Left ({AttendSumm.EmplName},i - 1 );
exit for
)
);
lname
Lech Kulikowski
Posts: 2177
Joined: Tue Mar 20, 2018 5:34 am

Re: crystal formula used to group

Post by Lech Kulikowski » Thu Feb 13, 2020 9:44 pm

Hello,

You can use the following expression:
{Substring(AttendSumm.EmplName, AttendSumm.EmplName.IndexOf(" "), AttendSumm.EmplName.Length)}

Thank you.
jgoswalt
Posts: 3
Joined: Mon Feb 10, 2020 4:40 pm

Re: crystal formula used to group

Post by jgoswalt » Mon Feb 17, 2020 2:45 pm

Lech, I need to be able to search backwards, as some employee names have a middle initial. Using your above example I get:
Amy A. Bear
Joe E. Honious
Jack E. Reno
Jason Fray
john Isaacs
Lech Kulikowski
Posts: 2177
Joined: Tue Mar 20, 2018 5:34 am

Re: crystal formula used to group

Post by Lech Kulikowski » Wed Feb 19, 2020 9:18 pm

Hello,

You can use a more complex expression to get the necessary result or prepare an additional column for grouping in data source.

Thank you.
jgoswalt
Posts: 3
Joined: Mon Feb 10, 2020 4:40 pm

Re: crystal formula used to group

Post by jgoswalt » Tue Feb 25, 2020 2:42 pm

Still not sure how to do this? All I seem to get is the function name printing out. Any more help would be appreciated.
Post Reply