11 Replies Latest reply on Jul 23, 2013 8:00 AM by productionQC

    Long Term Storage In Global Field(s)



      Long Term Storage In Global Field(s)



           Just a quick question - I have global fields that users set fixed costs in for caculating product production costs.  So for a simple example, a user could set a profit margin % at 5 and then all products costs are calculated using this global field.  The problem is that the next day when everyone logs back into the server, all these values are gone.  How to I make it so that the field remains as  "global" as well as retains the previous set values day in and day out, rather than starting fresh each time we fire up.





        • 1. Re: Long Term Storage In Global Field(s)

               Store the data in regular, non global fields in a table in your database. Use a script that is set to run "onFirstWIndowOpen" in File Options to copy the values from the non-global fields to the global. To make lasting change to the global field's value, edit the value in the nonglobal field from which it is loaded.

          • 2. Re: Long Term Storage In Global Field(s)

                 Perfect, Thanks Phil...I had thought about this but just wanted to make sure I was not missing an easier path...




            • 3. Re: Long Term Storage In Global Field(s)

                   There IS an alternative, but it's usually not easier. You can stop using global fields for these values and link in that one record table of values I described in my first post to every Table Occurrence where it is needed using the X operator instead of the default = operator.

              • 4. Re: Long Term Storage In Global Field(s)

                     Hi Phil - Got this up and running, but I have a problem now tracking changes.  I use the following calcuation in auto enter to track change dates to certain fields--  If(MixFixedTruckingNG;Get(CurrentTimeStamp);Get(CurrentTimeStamp)) -- Works great on global fields, before I made the change mentioned above, now it won't give me anything but an blank field.  I have moved the calculation to the table where the non-global fields are.  They have been setup in a new and different table specifically for Fixed numbers to copy to global fields...When I use the calculation in the new table it no longer seems to track changes.  Any ideas?

                • 5. Re: Long Term Storage In Global Field(s)

                       I can't tell from the details shared so far how that is intended to work. You can always set up a timestamp field to auto-enter a modification timestamp, so I don't see the purpose to your calculation.

                  • 6. Re: Long Term Storage In Global Field(s)

                         Hi Phyl- Sorry, the calculation is actually much longer.  The result is based on 4 fields, I copied it when I was testing, before I put the other three in...If it was just the one field then yes, I would have used auto validation.  It now works fine, all of a sudden, but now my script to copy from regular fields to global does not work.  The script worked fine when yesterday and populated the global fields as expected...Now the script runs and nothing, the fields are blank.  The opposite of yesterday (Verification Formula not working, script for global working.  Today - Formula working and script for global not.)  I have made zero changes that could affect this, so I am at a loss.  I have just deleted most of it and will rebuild on the a backup copy to see what happens.  Bug?  IDK...  I will let you know what happens after the rebuild...


                         Thanks again..


                    • 7. Re: Long Term Storage In Global Field(s)

                           Ok- So I have rebuilt this and can't seem to grab the data from regular field and set the global field.  I created a table called Fixedoperations.  In that table I create four fields, Trucking, Plant, Overhead, Markup.  In my other table, ProductCodes, I have created the same four fields as Global number fields (Trucking_GL, Plant_GL, etc).  The relationship between Fixed and Products is:   Fixedoperations::PK_FIXED   -------<  ProductCodes::K_Fixed.

                           I am using a script set to run under File Options / Script Triggers - onFirstWindowOpen.  The script is called splash...The first line turns user abort and the next for lines are Set Field [ProdcutCodes::Trucking ; GetField (Fixedoperations::Trucking_GL)] and so on.  I get no results.  The fields are blank.  Any ideas why this is happening?


                      • 8. Re: Long Term Storage In Global Field(s)

                             Best guess is that you are not on a layout that allows you to access the correc values in your Fixedoperations and/or PRoductCodes tables.

                             And you do not need to use GetFIeld here. It adds a needless layer of complication to your script design.

                             And GetField (Fixedoperations::Trucking_GL) does not return the value of Trucking_GL to be placed in ProdcutCodes::Trucking, BTW, it returns the value of the table and field named in the Trucking_GL field--I doubt that's really what you want to take place here.

                             IF all else fails, you may need to post the exact script that you have created.

                             To post a script to the forum:

                        1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
                        3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
                        5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
                        7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
                        • 9. Re: Long Term Storage In Global Field(s)

                               Hi Phil- This is the first script that opens with the Database to show a logo screen for a couple seconds before going to the main menus...  So I just added the part to populate the global fields, but it does not work.... What do you think...


                          • 10. Re: Long Term Storage In Global Field(s)

                                 Add a go to layout step to the beginning of your script that takes the script to a layout based on FixedOperations.

                            • 11. Re: Long Term Storage In Global Field(s)

                                   That did it Phil - Thank you... I could not see the forest through the trees....indecision