tomp Posted April 12, 2008 Posted April 12, 2008 I was having trouble with a custom function. Discovered that you can not pass a value from a repeated field to a custom function. I had to set a non-repeated field value to the value I wanted to pass and then use it as the custom function parameter. Is this a bug in FM? Seems you shouldn't have to go to through the extra step of 'set field' to use a custom function
The Shadow Posted April 12, 2008 Posted April 12, 2008 This is due to the fact that the entire repeating field can be passed. I suspect some other operation would disassociate it. So, CF( A[2] & ""; A[3] + 0 ), depending on your data type.
comment Posted April 12, 2008 Posted April 12, 2008 Huh? AFAIK, if you reference a repeating field as a parameter, only the first repetition is passed. I don't know of any bug.
The Shadow Posted April 12, 2008 Posted April 12, 2008 I didn't say there was a bug, just that the repeating fields are passed to the custom function as a field, not just the value. Here's an example file, notice the MyValueRep() custom function, which pulls data from a repetition other than the first, showing the data for the other repetitions is available inside the custom function. repeats.fp7.zip
comment Posted April 12, 2008 Posted April 12, 2008 Yes, I am aware of this perplexing duality of the parameter (my test file is nearly identical to yours). Still, that works only with repeating and aggregate functions (I think), so I didn't consider it relevant in the context of "can not pass a value from a repeated field to a custom function". If anything, it shows that on the contrary - you can pass several values from a repeating field to a custom function. I am still curious what led the OP to such sweeping conclusion.
Recommended Posts
This topic is 6129 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