4 Replies Latest reply on Dec 9, 2009 11:31 AM by Melinda

    Global field perform a find?

    Melinda

      Title

      Global field perform a find?

      Post

      It's me again...  I am using FM 9 (shared over a network) on a MAC (OS X) and am having trouble with a particular script.  I am a beginner to intermediate FM user, so the more detailed the replies ther better.

       

      I have a layout that collects information in the following fields: Name, Date, AM Activity, PM Activity, LPM Activity.  I want to perform a find that will find ONLY records that contain a particular number, regardless of whether the number (091044, for example) appears in one or all of the Activity fields -- as long as it appears in at least one of the fields, I want the record found.  So, I set up a global field (labeled gSearch), and a button to run the following script:

       

      Set Error capture [ On ]

      Go to layout [ Original Layout ]

      Enter Find Mode [ ]

      Set Field [ ADMIN DATA::AM Activity ; gSearch ]

      New Record/Request

      Set Field [ ADMIN DATA::PM Activity ; gSearch ]

      New Record/Request

      Set Field [ ADMIN DATA::LPM Activity ; gSearch ]

      Perform Find [ ]

      If [ not Get ( FoundCount ) ]

      Show custom message [ "No record found" ]

      End If

       

      It's not working.  It appears to perfom a find, but it finds ALL records, regardless of the number I asked it to find.

        • 1. Re: Global field perform a find?
          philmodjunk
            

          The script looks correct so I'd look at the fields involved and the data they contain.

           

          Did you select "global storage" for gSearch on the Storage tab in Field Options?

           

          Are gSearch and the three activity fields all defined as number or text? Given your example with a leading zero they should all be defined as text.

           

          • 2. Re: Global field perform a find?
            Melinda
              

            I just went back throught the script and Set Field [ ADMIN DATA::AM Activity ; gSearch ] is actually written like this in the script: 

             

            <!--  [if gte mso 9]&gt;&lt;xml&gt; &lt;o:DocumentProperties&gt;   &lt;o:Template&gt;Normal.dotm&lt;/o:Template&gt;   &lt;o:Revision&gt;0&lt;/o:Revision&gt;   &lt;o:TotalTime&gt;0&lt;/o:TotalTime&gt;   &lt;o:Pages&gt;1&lt;/o:Pages&gt;   &lt;o:Words&gt;8&lt;/o:Words&gt;   &lt;o:Characters&gt;47&lt;/o:Characters&gt;   &lt;o:Company&gt;Teachers Development Group&lt;/o:Company&gt;   &lt;o:Lines&gt;1&lt;/o:Lines&gt;   &lt;o:Paragraphs&gt;1&lt;/o:Paragraphs&gt;   &lt;o:CharactersWithSpaces&gt;57&lt;/o:CharactersWithSpaces&gt;   &lt;o:Version&gt;12.0&lt;/o:Version&gt; &lt;/o:DocumentProperties&gt; &lt;o:OfficeDocumentSettings&gt;   &lt;o:AllowPNG/&gt; &lt;/o:OfficeDocumentSettings&gt; &lt;/xml&gt;&lt;![endif]  --><!--  [if gte mso 9]&gt;&lt;xml&gt; &lt;w:WordDocument&gt;   &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:TrackMoves&gt;false&lt;/w:TrackMoves&gt;   &lt;w:TrackFormatting/&gt;   &lt;w:PunctuationKerning/&gt;   &lt;w:DrawingGridHorizontalSpacing&gt;18 pt&lt;/w:DrawingGridHorizontalSpacing&gt;   &lt;w:DrawingGridVerticalSpacing&gt;18 pt&lt;/w:DrawingGridVerticalSpacing&gt;   &lt;w:DisplayHorizontalDrawingGridEvery&gt;0&lt;/w:DisplayHorizontalDrawingGridEvery&gt;   &lt;w:DisplayVerticalDrawingGridEvery&gt;0&lt;/w:DisplayVerticalDrawingGridEvery&gt;   &lt;w:ValidateAgainstSchemas/&gt;   &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:Compatibility&gt;    &lt;w:BreakWrappedTables/&gt;    &lt;w:DontGrowAutofit/&gt;    &lt;w:DontAutofitConstrainedTables/&gt;    &lt;w:DontVertAlignInTxbx/&gt;   &lt;/w:Compatibility&gt; &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]  --><!--  [if gte mso 9]&gt;&lt;xml&gt; &lt;w:LatentStyles DefLockedState=&quot;false&quot; LatentStyleCount=&quot;276&quot;&gt; &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]  --><!--  /* Font Definitions */ @font-face      {font-family:Cambria;      panose-1:2 4 5 3 5 4 6 3 2 4;      mso-font-charset:0;      mso-generic-font-family:auto;      mso-font-pitch:variable;      mso-font-signature:3 0 0 0 1 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal      {mso-style-parent:&quot;&quot;;      margin:0in;      margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:12.0pt;      font-family:&quot;Times New Roman&quot;;      mso-ascii-font-family:Cambria;      mso-ascii-theme-font:minor-latin;      mso-fareast-font-family:Cambria;      mso-fareast-theme-font:minor-latin;      mso-hansi-font-family:Cambria;      mso-hansi-theme-font:minor-latin;      mso-bidi-font-family:&quot;Times New Roman&quot;;      mso-bidi-theme-font:minor-bidi;} @page Section1      {size:8.5in 11.0in;      margin:1.0in 1.25in 1.0in 1.25in;      mso-header-margin:.5in;      mso-footer-margin:.5in;      mso-paper-source:0;} div.Section1      {page:Section1;}   --><!--  [if gte mso 10]&gt; &lt;style&gt; /* Style Definitions */ table.MsoNormalTable      {mso-style-name:&quot;Table Normal&quot;;      mso-tstyle-rowband-size:0;      mso-tstyle-colband-size:0;      mso-style-noshow:yes;      mso-style-parent:&quot;&quot;;      mso-padding-alt:0in 5.4pt 0in 5.4pt;      mso-para-margin:0in;      mso-para-margin-bottom:.0001pt;      mso-pagination:widow-orphan;      font-size:12.0pt;      font-family:&quot;Times New Roman&quot;;      mso-ascii-font-family:Cambria;      mso-ascii-theme-font:minor-latin;      mso-hansi-font-family:Cambria;      mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]  --><!--  StartFragment  -->Set Field [ADMIN DATA::AMActivity[ADMIN DATA::gSearch]]

             

            I am unable to to write it as it is in bold, i get an error message telling me an operator is needed and ;ADMIN:gSearch is selected.  I am guessing this is where the problem is, because nothing else makes sense...  

             


            PhilModJunk wrote:

            The script looks correct so I'd look at the fields involved and the data they contain.

             

            The gSearch field is just a global text field, nothing else special about it, and the Activity fields are just text fields.

             

            Did you select "global storage" for gSearch on the Storage tab in Field Options?

             

            Global storage checked (with 1 repetition -- i just left that as is).

             

            Are gSearch and the three activity fields all defined as number or text? Given your example with a leading zero they should all be defined as text.

             

            Are gSearch and the three activity fields  are all defined as text.

             


            EDIT:  To perform the find, I enter the Activity number I want to find in the global field and hit the "find Activity" button the rns the script...  have I maybe set this up incorrectly?

             

             

             

             

             

             


            • 3. Re: Global field perform a find?
              philmodjunk
                 Many new users get confused the first time they try to add Set Field to a script. See the following link for step by step instructions:

              http://forum-en.filemaker.com/fm/board/message?board.id=FM-en-4&thread.id=31602
              • 4. Re: Global field perform a find?
                Melinda
                   THANK YOU!!