7 Replies Latest reply on Apr 23, 2012 5:29 AM by Mike_Mitchell

    how to ??



      i couldnt script can anyone please help me with this

        • 1. Re: how to ??

          Hello, gkrambati.


          Your sample file has only custom value lists, so it's a little hard to determine exactly what you're trying to accomplish. Are you trying to have FileMaker populate a return-delimited list in the field "chat" with some conditional statements based on what the contents of the field "text" are?


          If that's the case, there are a couple of different ways to accomplish this. The "quick and dirty" way would be a calculation, using the Case function and a series of Substitute functions. For example:


          Case ( PatternCount ( text ; "tea" ) ; Substitute ( "{cr} is good.{cr} is bad." ; "{cr}" ; "tea" ) ; "" ) & Case ( PatternCount ( text ; "milk" ) ; Substitute ( "{cr} is white.{cr} has calcium." ; "{cr}" ; "milk" ) ; "" )


          and so forth (where {cr} represents the carriage return character, or pilcrow).


          Of course, this will only work if you never change the conditions; otherwise, it has to be changed as well. A better way would be to use a related table that contains a record for each of the search terms (tea, milk, etc.) and then run either a script or a custom function to do the substitution.





          • 3. Re: how to ??

            Oops. Sorry. The function should read:


            Case ( PatternCount ( text ; "tea" ) ; Substitute ( "{cr} is good.{cr } is bad." ; "{cr}" ; "{cr}tea" ) ; "" ) & Case ( PatternCount ( text ; "milk" ) ; Substitute ( "{cr} is white.{cr} has calcium." ; "{cr}" ; "{cr}milk" ) ; "" )


            My bad. Stripped out the carriage returms. That should work better.



            • 4. Re: how to ??

              sir please check my uses2 file which i have given above pls re script it please

              • 5. Re: how to ??

                File is missing a needed table and has no records. Sorry; nothing to check.

                • 6. Re: how to ??




                  sir without you i wouldnt be possible i did little modification


                  sir is there any other altenative for the above script to get desired result using other functions

                  • 7. Re: how to ??

                    Well, what you've done is quite a bit different from what I gave you. What is your desired end result?


                    To answer the question, yes, there are other ways to do this. You can store the result for each term (tea, milk, etc.) in a field in a separate table and simply substitute that based on a relational join. You can also use the various list-based functions (like List, GetValue, and so forth) to extract the needed values. Those methods are a little more complex, though, despite being more flexible.