on 04-09-2014 3:22 PM
Hi All,
I have the following table, Full_Name column is the original data and Modified column is from Crystal Report Formula Field. I want to take out 'in Boston', 'in New York', and 'in Los Angeles' from the Full_Name and write it under Modified (as shown in the table). It would be a simple code, I tried it many ways but it's not working. Can someone help me writing the code please. Thanks - Brian
Full_Name | Modified |
John in Boston | John |
Bell in New York | Bell |
Tiger in Los Angeles | Tiger |
Rodney in Boston | Rodney |
Graham in Boston | Graham |
Bill in New York | Bill |
Marry in New York | Marry |
Juaida in Los Angeles | Juaida |
Felton in New York | Felton |
Shawn in Los Angeles | Shawn |
Hi,
Try this code:
Split({Full_Name}, " in ")[1]
--Praveen G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Brian,
Try this code:
Split({Full_Name}, " ")[1]
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash, You and I are almost there. Actually text under Full name column are way bigger than I mentioned. It's like:
Full_Name
John Valley in New York
Lake point Valley in Boston
Southwood Country club Course in Los Angeles
So, What I have to do is: take out 'in New York', 'in Boston', 'in Los Angeles' from each line rather than keeping the first word (the way you showed) only. Can you please help writing the code for that?
Sorry, it was a little confusing in my previous post.
Thanks, Brian.
Hi Abhilash, I tried your send one but it's not working. I wrote it as follows:
Replace(Replace(Replace({Modified}, " in New York"), " in Boston"), " in Los Angeles")
Modified is the formula field and Full_Name is the field from Database. Can you please confirm if the above codes are working/right code from your end?
Thanks a bunch.
Brian
That would involve creating a variable that contains the city names and then extracting the names based on the values in the variable.
1) Create a variable that contains city names and place this on the Report Header.
WhilePrintingRecords;
stringvar array city := ["Boston", "New York", "Los Angeles"];
"";
2) Create another formula that extracts the city names from the field on the details section. This goes in the Details section of course:
WhilePrintingRecords;
stringvar array city;
local stringvar temp;
local numbervar i;
for i := 1 to ubound(city) do
(
If Instr({Full_Name}, city[i]) > 0 then
temp := city[i]
else temp := "No City Found";
);
temp;
-Abhilash
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.