Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Functions/Methods in formula fields? 1

Status
Not open for further replies.

eatwork

Technical User
May 16, 2005
155
CA
Hi,
I was wondering if it is possible to create multiple functions within a formula field? I have 4 functions that I am importing into a new crystal report and I don't think it will work if I need to merge all of the formulas together. Thank you
 
If you mean - "Can you have more than one function in a formula" - yes, of course you can - for example - you can use the ToText() function to turn a number into a string - then use the Length{} function in the same formula to return the number of characters in the new string.

You can also nest one function inside another within one formula.

I hope this answers your question.

cheers
paulmarr
 
Hi paulMarr,
Thank you for your reply. I understand that I am able to utilize more than one built in function within a formula field, but I was wondering is there anyway to set up other functions within the formula field or through the custom functions to handle my importing of the 4 different functions. eg.
Code:
Public function test1(byval var1, byval var2) as string
   return str
end function
Public function test2(byval var1, byval var2, byval var3) as string
return str
end function
etc.
If so, do you know what the syntax for the functions might look like? thank you
 
As far as I am aware there is no way to call functions residing in dll libraries that were not specifically created for Crystal Reports.

Previous versions of Crystal allowed you to create custom functions that when registered properly would appear as a function within the formula editor. For example - provide dlls allowing you to email reports via a function call within a Crystal formula.

As of Crystal V9 & 10 - custom functions are created within Crystal Reports and stored in the repository for use by the wider development group on the network.

The custom functions you create are not functions that deal with API calls or O/S functionality - but are usually data related. You would need to recreate your functions within Crystal using either Crystal or Basic syntax.

I hope this helps you.

Cheers
paulmarr
 
Hi paulmarr,
Thank you for your reply and excellent post. I was wondering if those custom functions are able to calculate certain aspects of the data.
For example. my report will display dimensions of a particular product. this product has a length, width, height and weight. The formulas I will be importing will take this data, and convert it to metric or imperial based on a boolean. Each aspect (length, width, height, weight) have its own function, but I need to call one main function which will call the smaller functions. the large function is called ex. formatDimensions(length, width,height,weight, metric)

will custom functions work for this? thank you again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top