June 25, 200718 yr Hi All, Is is possible to have endless parameters in a custom function (like there are in the Case function, for example)? Thoughts? Thanks!
June 25, 200718 yr 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 ?
June 25, 200718 yr Author 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
June 25, 200718 yr 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.
June 25, 200718 yr 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
June 25, 200718 yr 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
Create an account or sign in to comment