saranyc Posted June 25, 2007 Share Posted June 25, 2007 Hi All, Is is possible to have endless parameters in a custom function (like there are in the Case function, for example)? Thoughts? Thanks! Link to comment Share on other sites More sharing options...
Raybaudi Posted June 25, 2007 Share Posted June 25, 2007 Yes... One multi-values parameter and a CF that evaluates each values. Like: SumCF ( par1 ; par2 ; par3 ; ... ; parN ) Evaluate ( Substitute ( par ; ";" ; "+" ) ) Can you give us an example of the CF you want to do ? Link to comment Share on other sites More sharing options...
saranyc Posted June 25, 2007 Author Share Posted June 25, 2007 well as a really simple example, a custom function called Add that adds as many values as you want from unlimited fields. (The function I actually want to create is really complicated, and I'm not sure I can explain it very well...) I'm not sure what you meant by the multi-value parameter- where do you designate multi-value status? Thanks! Sara Link to comment Share on other sites More sharing options...
fabriceN Posted June 25, 2007 Share Posted June 25, 2007 Substitute() is often the key to this kind of challenges. More details on your need would help us, since Sum() already does exactly what you proposed as an example. You can still have a look at this file, which includes a custom function SubstituteManyWithCalculation http://www.bh-a.com/downloads_1.1.html#HilightSearchTerms It could actually be done (I would even recommend it) without a custom function, but if you have many of these things to do, it's still a time saver. Link to comment Share on other sites More sharing options...
Genx Posted June 25, 2007 Share Posted June 25, 2007 Hi Sara, You could pass a paramater like: Actual CF: MyCF( var ) CF Call: MyCF( List( field1 ; field2 ; field3 ; field4 ; field5; ... ; fieldn ) ) Then you can get the number of paramaters using ValueCount(var) and you can interact with a particular parameter using GetValue( var ; n ) where n is the parameter you want to retrieve. HTH Link to comment Share on other sites More sharing options...
Raybaudi Posted June 25, 2007 Share Posted June 25, 2007 Ok, my example was exactly like your example ! Say that we define a CF like this: ------------ /* Add ( par ) Custom Function */ Evaluate ( Substitute ( par ; ";" ; "+" ) ) ------------ Now, if the calculation field is: Add ( "1;7;5" ) the result will be: 13 Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6158 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now