Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Custom Functions Post Reply Post New Topic
Author Message
esther31
Groupie
Groupie


Joined: 19 Dec 2011
Online Status: Offline
Posts: 50
Quote esther31 Replybullet Topic: Custom Functions
    Posted: 22 Aug 2013 at 9:35pm
Hello
 
Recently a consultant wrote a custom function for me that I now need to edit, can you help please as I've never used them and have no idea where to start!!!
 
This is what the consultant wrote:
 
Function  (stringVar FeeProfile)
local stringvar value := FeeProfile;
if len(FeeProfile) >0 then
(
    value := replace(value, chr(19), ">");
    value := replace(value, chr(18), "=");
    value := replace(value, chr(20), "<");
    value := replace(value, chr(21), "!");
    value := replace(value, chr(22), "&");
    value := replace(value, chr(23), "|");
);
value;
 
Basically I need to replace another value with *  but i'm not sure how to write this or determine which character number it is!! can anybody help me unpick the function above and then add my extra bit please?
 
Thanks!!
 
Esther
IP IP Logged
praveeng
Senior Member
Senior Member
Avatar

Joined: 11 Jul 2011
Online Status: Offline
Posts: 165
Quote praveeng Replybullet Posted: 23 Aug 2013 at 12:50am

Hi Esther,

As per your description, I understand that you need to edit the existing Repository function in Cyrstal Reports. Kindly correct me if I am wrong.

If Yes then follow below steps to edit your Crystal fucntion formula:

Open Formula editor in the designer.
Expand "Repositroy Custom Function" then right click on the formula and select "Add to Report"
Now Expand the "Report Custom Function", Select the formula and click on "Disconnect From repository".
Then formula editor will enable you to Edit the formula.
Edit the formula and Right click on the formula and select "Add to Repository".
Then the changes will appear in Repository function.

-Praveen G

Praveen Guntuka,
praveen_guntuka@yahoo.com
IP IP Logged
esther31
Groupie
Groupie


Joined: 19 Dec 2011
Online Status: Offline
Posts: 50
Quote esther31 Replybullet Posted: 23 Aug 2013 at 1:08am
Hello
 
Thanks for this. Yes you are correct I need to edit the formula but i'm unsure how/ what I need to edit!! where will this refer to: Function  (stringVar FeeProfile)
 
I'm presuming I need to identify which character in the string I want to change to * but i'm not sure how to even find the string!
 
Sorry
 
Esther
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 23 Aug 2013 at 2:35am
Hi

Add one more line as shown below in your custom function :


Function (stringVar FeeProfile)
local stringvar value := FeeProfile;
if len(FeeProfile) >0 then
(
    value := replace(value, chr(19), ">");
    value := replace(value, chr(18), "=");
    value := replace(value, chr(20), "<");
    value := replace(value, chr(21), "!");
    value := replace(value, chr(22), "&");
    value := replace(value, chr(23), "|");
    value := replace(value, "sting to replace", "*");
);
value;
Thanks,
Sastry
IP IP Logged
esther31
Groupie
Groupie


Joined: 19 Dec 2011
Online Status: Offline
Posts: 50
Quote esther31 Replybullet Posted: 23 Aug 2013 at 3:45am
Thank you, is the string FeeProfile? I'm not sure where to find it.
 
THanks
Esther
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 23 Aug 2013 at 5:44am
The custom function can be applied to any string or string type field so no one can tell you what it is from that formula you posted.
If you look at the report where your consultant used it (it will be in a formula field), open that formula field and you can see what string field it was applied to. It is the FunctionNAmeHere({table.stringfieldhere})
example
ReplaceCharacterFUnction({table.stringa})
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.