Print Page | Close Window

Custom Functions

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19935
Printed Date: 30 Apr 2024 at 2:54am


Topic: Custom Functions
Posted By: esther31
Subject: Custom Functions
Date 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



Replies:
Posted By: praveeng
Date 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


Posted By: esther31
Date 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


Posted By: Sastry
Date 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


Posted By: esther31
Date Posted: 23 Aug 2013 at 3:45am
Thank you, is the string FeeProfile? I'm not sure where to find it.
 
THanks
Esther


Posted By: DBlank
Date 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})



Print Page | Close Window