rivet Posted August 24, 2009 Share Posted August 24, 2009 Can anyone help reduce this to a recursive calculation. The actual list is over fifty items. Let ( [ lst = "car¶dog¶apple¶kitchen sink¶ball¶tree¶table¶bottle" tab = " " ] ; If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 1 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 2 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 3 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 4 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 5 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 6 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 7 ) ; "¶" ; "" ) ); "•" ; "" ) & tab & If ( PatternCount ( specialty ; Substitute ( GetValue ( lst ; 8 ) ; "¶" ; "" ) ); "•" ; "" ) & tab ) Link to comment Share on other sites More sharing options...
comment Posted August 24, 2009 Share Posted August 24, 2009 What's in the specialty field, and what exactly is the purpose of this calculation? BTW, the result of GetValue() cannot - by definition - contain a carriage return, so all those substitutions are redundant. Link to comment Share on other sites More sharing options...
David Jondreau Posted August 25, 2009 Share Posted August 25, 2009 (edited) What does the data in the field "specialty" look like? What is your goal with this calculation? Edited August 25, 2009 by Guest Ninja'd by commet! Link to comment Share on other sites More sharing options...
rivet Posted August 25, 2009 Author Share Posted August 25, 2009 specialty is a single field formatted as a check box, with that list of values. In the end I am trying to create a chart. Records down the left, value list across the top, then a grid of dots showing which values where checked for that records. v1 v2 v3 v4 v5 v6 v7 v8 v9.... record1 | • | | • | | • | | • | • | • | record2 | | | • | • | | • | • | • | • | record3 | | • | • | | • | • | | | | ignore the vertical bars, they are to illustrate the columns.There will be a tab character for each column, so I can space the result with the text ruler. Link to comment Share on other sites More sharing options...
comment Posted August 25, 2009 Share Posted August 25, 2009 1. PatternCount() is not a good test for finding if a specific value has been checked: it can easily return a false positive when one value contains another, e.g. "run" and "crunch". 2. IMHO, the best way to do this is to use a repeating calculation field = not IsEmpty ( FilterValues ( GetValue ( ValueListItems ( Get (FileName) ; "Categories" ) ; Get ( CalculationRepetitionNumber ) ) ; Extend ( Specialty ) ) ) Make the result type a Number, and format the field as Boolean, showing non-zeros as a bullet. 3. If you prefer to use a custom function, try: TabularizeValues ( listOfValues ; selectedValues ) Let ( [ countValues = ValueCount ( listOfValues ) ] ; Case ( not IsEmpty ( FilterValues ( GetValue ( listOfValues ; 1 ) ; selectedValues ) ) ; "•" ) & Case ( countValues > 1 ; Char (9) & TabularizeValues ( RightValues ( listOfValues ; countValues - 1 ) ; selectedValues ) ) ) Link to comment Share on other sites More sharing options...
rivet Posted August 25, 2009 Author Share Posted August 25, 2009 Thanks Comment. I went with the repeating fields, which saves much time -- no tabbing, and no placing of vertical lines. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 5382 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