4 Replies Latest reply on Mar 27, 2013 7:31 PM by PaulSeabright

    Some corrupt fields

    PaulSeabright

      Title

      Some corrupt fields

      Post

           I have a problem with a solution I have created that I don't understand.  I would appreciate any insights or help folk may have!

           The solution comprises of two files, one containing just the tables, and the other the layouts, relationships and scripts.

           In the table 'SupplierDetails' there is a field that contains a 1 or 0 to indicate whether a data file can be sent to this supplier.

           On the layout 'SuppliersDetails' there is a button that runs a script to toggle this value between 0 and 1, and conditional formatting that changes the color of a check mark to show green when the date value is 1, else white.

           The problem is that for about 10% of the 104 records, this does  not work. For the remainder, it does.  The records seem to be randomly dispersed thorough out the data set.

           So far I have tried without success;

             
      •           Removing the indexes for that table, closing Manage Database, then reopening and turning on the indexing again.
      •      
      •           Recovering both files to a different file
      •      
      •           Removing the button, saving the layout, then recreating the button and link to the script.
      •      
      •           Deleting the affected record and recreating it.  It does seem that although the affected records are randomly distributed through the data set, all new records are affected.
      •      
      •           Manually entering a '1' in the Supplier SendDataFile field works

           All other fields accept data fine.

           Screen shot of the script attached


      Any help greatly appreciated!

            

           Cheers

      Script.PNG

        • 1. Re: Some corrupt fields
          philmodjunk

               On your layout, if you check Layout Setup... (Enter layout mode). What text appears in "show records from"?

               My concern is that your script does not directly refer to any data in SupplierDetails. It refers to data via the table occurrence "supplierDetails 2". This implies two occurrences of SupplierDetails. If your layout is based on SupplierDetails instead of SupplierDetails 2, there is a relationship involved that could be preventing access to the field.

               You can also simplify this part of your script:

               Everything above the # line can be replaced with:

               If [ Get ( ScriptParameter ) = "Supplier" ]
                  Set Field [Supplier Details 2::SupplierSendDataFile ; Not Supplier Details 2::SupplierSendDataFile ]
               End If

               But note that I am also using Supplier Details 2. If this is not the Tutorial: What are Table Occurrences? on which your layout is based, you should either change the setting in Layout setup or modify the reference to supplier details 2 here in your script.

          • 2. Re: Some corrupt fields
            PaulSeabright

                 Thank you!

                 That fixed the problem!

                 The layout was showing records from SupplierDetails, not SupplierDetails 2.  Ammending the script sorted it.

                 I tried the simplification, but I guess it's not a function that is available in FileMaker Pro 10?

                 I could have spent the next month looking at this and not spotted my error.

                  

                 Cheers,

                 Paul

                  

            • 3. Re: Some corrupt fields
              philmodjunk

                   This should work fine in Filemaker 10. What happened when you tried that option?

                   This option assumes that SupplierSendDataFile is a field of type number. It may not work if it is of type text.

              • 4. Re: Some corrupt fields
                PaulSeabright

                     It does - just me being a little slow.  Once the incantation was entered correctly, it ran fine.

                     Thanks again for  your patience - that's two more learning points to tuck away for future use!