rivet Posted November 19, 2014 Share Posted November 19, 2014 I have a simple check field with the letters A-G Depending on what the user clicks, I would like to simplify the results annotated as a range: ie. A-D,E,F A,B,E-G A,B,D etc Any thoughts, CF's? NOTE: just added an attachment to work with and noticed a sort has to be applied. Link to comment Share on other sites More sharing options...
comment Posted November 19, 2014 Share Posted November 19, 2014 See if you can adapt: http://www.briandunning.com/cf/734 1 Link to comment Share on other sites More sharing options...
rivet Posted November 19, 2014 Author Share Posted November 19, 2014 alright Comment! that and a Sort function did it. Thanks Let ( [ txt = SortList ( tbl::selection ; "Asc" ; "Text" ) ; num = Substitute ( txt ; [ "A" ; "1" ]; [ "B" ; "2" ]; [ "C" ; "3" ]; [ "D" ; "4" ]; [ "E" ; "5" ]; [ "F" ; "6" ]; [ "G" ; "7" ] ) ; abrv = CollapseList ( num ); alph = Substitute ( abrv ; [ "1" ; "A" ]; [ "2" ; "B" ]; [ "3" ; "C" ]; [ "4" ; "D" ]; [ "5" ; "E" ]; [ "6" ; "F" ]; [ "7" ; "G" ] ) ]; alph ) 1 Link to comment Share on other sites More sharing options...
comment Posted November 20, 2014 Share Posted November 20, 2014 Sorting can be done simply and quickly (!) by = FilterValues ( "A¶B¶C¶D¶E¶F¶G" ; Selection ) or, to make it future-proof = FilterValues ( ValueListItems ( Get ( FileName) ; "YourValueList" ) ; Selection ) 1 Link to comment Share on other sites More sharing options...
comment Posted November 20, 2014 Share Posted November 20, 2014 An afterthought: you're performing 14 substitutions just to convert the letters to numbers and back, so that you can use the custom function. With 15 substitutions, you could substitute: A,B,C,D,E,F,G ==> A-G A,B,C,D,E,F ==> A-F B,C,D,E,F,G ==> B-G A,B,C,D,E ==> A-E B,C,D,E,F ==> B-F C,D,E,F,G ==> C-G A,B,C,D ==> A-D B,C,D,E ==> B-E C,D,E,F ==> C-F D,E,F,G ==> D-G A,B,C ==> A-C B,C,D ==> B-D C,D,E ==> C-E D,E,F ==> D-F E,F,G ==> E-G and be done with it. 1 Link to comment Share on other sites More sharing options...
rivet Posted November 20, 2014 Author Share Posted November 20, 2014 'inverting' the FilterValues function slick and a new one for me, works great... thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 3459 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