8 Replies Latest reply on Aug 10, 2015 6:48 AM by MariusPirv

    Shared file global field

    MariusPirv

      Title

      Shared file global field

      Post

      Hello guys,

      I've recently got into a problem with a shared file. I have a field that is used global.

      The problem is that this file is shared and it seems that every user has its own global field, now I'm using this to know the next invoice number. This way the next invoice created will have this number, then the number gets +1. Invoice number is set when the user clicks save so it can't be a serial field instantiated on creation. Also some of the invoices might get deleted or redone so serial is not an option.

      Now my fix, I used to set the invoice number as max(invoice number) +1 but it appears that even so there is still the possibility of having an invoice with the same number as people work in paralel on this an this is not acceptable.

      Is there any way I can get one field global on all shared users, which can be set by script (save button). This way the workers will be able to do invoices in paralel? Or at least some workaround or ideea.

      Thank you,

      Marius

        • 1. Re: Shared file global field
          philmodjunk

          Global fields were designed to work this way. Every user get's a "virtual copy" of the global field and changes made to a global field are not seen by other users.

          Your scripted work around is not safe as you have discovered. If two users run the script at nearly the same time, both can get exactly the same value and you get duplicate values.

          What you should do with your invoice number if open field options and define the field to auto-enter the serial number. You then do not need a global field nor do you need a script.

          For more on globals and hosted files: http://help.filemaker.com/app/answers/detail/a_id/3604/kw/global

          • 2. Re: Shared file global field
            MariusPirv

            Hi,

            I read about these copied global fields and I though there is a workaround or some other type of field.

            I can't use a serial number as a unique ID for invoice number because the Invoice in my software can be 3 types, and each type should have the unique ID incremented, not random, this is how the law states it so I can have a total number of invoices upon inspection. Therefore if I create and delete one the serial number will skip it.

            Is there any field declared only once that even if the file is shared ?

            If not, how could I create such thing in order for multiple people to use one field and increment a number depending on the invoice type :(

             

            Thank you for your time Phil.

            Marius

            • 3. Re: Shared file global field
              philmodjunk

              You still need to use the auto-entered serial number. Once you assign such a value to an invoice, you do not ever delete it. If the need to delete it arises, mark it as "void" and zero out any fields that would other wise report a currency value for the invoice. This is just like printed receipts and allows you to generate the needed values from the far simpler and safer auto-entered serial number feature.

              (And it is possible to assign such a serial number to a field "on demand" with a bit of creative design work.)

              • 4. Re: Shared file global field
                MariusPirv

                Hello Phil,

                Do you know of any plugin that could do what I'm asking for. Either as global field or variable, any way.

                Thank you,

                Marius

                • 5. Re: Shared file global field
                  philmodjunk

                  You can get the total number of invoices "on inspection" without having a perfect sequence of ID's. I still think you can get an auto-entered serial number to do what you need and that will not require a plug in.

                  • 6. Re: Shared file global field
                    MariusPirv

                    What do you mean "on inspection", I'm still relatively new to filemaker.

                    Please help me with a solution on using auto-entered serial numbers because I can't come with one. As I said I have to invoices types, and an invoice can be deleted and also switch type, making it void doesn't help because I have to have a valid invoice for each invoice ID.

                    I'm sorry that I keep asking this questions, but my problem still persists :(.

                    Thank you

                    Marius

                    • 7. Re: Shared file global field
                      philmodjunk

                      "on Inspection" is a quote from your post. What do YOU mean by that phrase?

                      And what does the invoice type have to do with the invoice number? Why does a different type of invoice require a change in the invoice number? Please describe these two types.

                      Why do you need a valid invoice for every ID?

                      I'm not trying to argue here, I'm trying to understand the problem.

                      • 8. Re: Shared file global field
                        MariusPirv

                        Same here with the arguing ( I'm grateful for the help you provide ).

                        So, I have too types of invoices which are done ( Proforma, Fiscala ). All invoices start as "oferta" which is offer and can become one of those 2 types. After they become x or y I print the invoice (therefore good invoice nr is required), but if the invoice is canceled (by the client lets say ) then I have to delete it.

                        This is why right know I have a global field for Proforma and one for fiscal which take value of (Select max (invoice id/ type) + 1 ).

                        The same with the invoice number, but here if they are done at the same time for the same type then I'll get two invoices with the same invoice nr. (Problem)

                        I do the incrementing by (Select max (invoice id/ type) + 1 ). Is there a way to pause the script until this is done so I don't get same max()+1 for 2 invoices. Or do you have any other idea.

                        Thank you :)

                        Marius