2 Replies Latest reply on Oct 4, 2013 10:28 AM by philmodjunk

    need help with Case



      need help with Case


           I have a field named Diagnosis that contains free text. example: Other closed fractures of distal end of radius (alone);  Scaphoid fracture of wrist

           I am trying to create a field named Body Area that contains text based on what's entered in Diagnosis (e.g., if diagnosis contains "wrist", Body Area would display "wrist".)


           I tried testing it out with Case ( DIAGNOSIS = "*wrist*" ; "wrist" ; DIAGNOSIS = "*hand*"  or "*finger*"; "hand"; "" ) but it's not doing anything. I tried with and without the wildcard operators. 


           Thanks for any help-

        • 1. Re: need help with Case

               Go and look at the PatternCount ( ) function.

          • 2. Re: need help with Case

                 And to steal an idea of Raybaudi's from another post, you might try this to get a list of body parts extracted from the "free text":

                 Let ( [ T = YourTable::YourTextField ;
                            TheList = Substitute ( Filter ( Lower ( T ) ; " abcdefghijklmnopqrstuvwxyz" ) ; " " ; ¶ ) // makes a return separated list of words in lower case
                         ] ;
                         FilterValues ( TheList ; List ( "wrist" ; "hand" ; "arm" ; //list all the body parts you want here ) )

                 The resulting list has each value separated by return--which can be useful, but you can use a second substitute function call to turn the ¶'s into commas with spaces or other characters if such is desirable.