macavity Posted July 11, 2007 Posted July 11, 2007 for want of a better way to describe it. Can someone find a good solution to this problem? The values contained in a field in a related table might look something like this, if listed: 1 2 3 4 7 9 10 11 12 I want this: 1-4, 7, 9-12 I have actually succeeded, using a looping script and a calculation field, but the calculation is very cumbersome. Also I wonder if it couldn't be done without a script - just with a calculation. Any ideas? Thanks in advance!
Raybaudi Posted July 11, 2007 Posted July 11, 2007 Hi you'll need a custom function or a calculation involving a repeating field. How many values can hold that list ?
JesseSFR Posted July 11, 2007 Posted July 11, 2007 You would proabably need the the following functions List() - returns a delimited list of related values ValueCount() - gets the total number of values in a list GetValue() - gets a specific value You could use all these together and accomplish what you are looking for. Let( [ numberCount = List(relatedField); middle = floor(numberCount/2) // get the middle and round down... you could round up with upper ]; // would need to create a recursive function here to display values from 1 to middle - 1 // then display middle // then use that same recursive function here to display the rest ) This is of course assumes you have one value per related record. It's a little complicated. I can probably put something together for you a little later or someone else may come along and finish it out for you.
macavity Posted July 11, 2007 Author Posted July 11, 2007 raybaudi: the list can be long or very short. Anything is possible. There is only one value per related record, but not a fixed number of related records. I'd be very grateful if a solution could be found that doesn't use a script. I needed the script to create the groups of consecutive numbers but I really hate to have to make the user push a button to get the result.
Raybaudi Posted July 11, 2007 Posted July 11, 2007 ... the list can be long... More than 10000 values ?
macavity Posted July 11, 2007 Author Posted July 11, 2007 no! Probably never more than perhaps 40 values.
comment Posted July 15, 2007 Posted July 15, 2007 See if this helps: http://www.briandunning.com/cf/734
Raybaudi Posted July 16, 2007 Posted July 16, 2007 Hi comment I was waiting for you on this post : P.S. there is the same problem that I had with situation like this: 1 2 3 4 6 7 The CF returns this result: 1 to 4, 6, 7, :
Raybaudi Posted July 17, 2007 Posted July 17, 2007 For me it must return: 1 to 4, 6 to 7 ( and surely not a final ¶ )
comment Posted July 17, 2007 Posted July 17, 2007 Mhm. I don't see it that way. To me, the "to" is a placeholder for SKIPPED values - and nothing is skipped between 6 and 7. I might consider getting rid of the trailing ¶ in the premium version of the function. :
Raybaudi Posted July 17, 2007 Posted July 17, 2007 To me, the "to" is a placeholder for SKIPPED values Yes, this is in fact an opinion matter : BTW: if the premium version could evaluate also my opinion... :P
Recommended Posts
This topic is 6399 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