Crystal Reports : Convert number var to decimal in crystal reports

Open the formula field editor in the report, right click on the report custom functions and click on New





The editor window will be opened. Paste the below code in the editor overwriting the text in it.


Function (numbervar Mins);
(
       numbervar toseconds;

      toseconds := Mins * 60;

      stringvar todecimal := totext((toseconds / 3600),0);

      todecimal;

)



The above code accepts a numbervar parameter. and returns a string

Your function will be created with the name you give 
As shown below i have two functions created.



You can call this function in your formulas and get a string value in return.






1 comment: