8 Replies Latest reply on Jul 31, 2015 8:23 AM by IJ

    Weird: Set any Variable $whatever -> result Set Field = 0 ?

    IJ

      Title

      Weird: Set any Variable $whatever -> result Set Field = 0 ?

      Post

      Hi, a weird thing. I'm setting a [indexed / auto-enter / serial / unique / required value] ID field as a variable, and always having the Set Field = 0 in the next layout within the same script, regardless! Changed the variable $name, changed the receiveing field name, changed the receiving fiield to text, and my script always deploys any number  to a "0" ! (eventualy tried the Let function in the Variable calculation to define the $ variable and didn't work as well!)

      Any idea where to go?

      Tnx,

      IJ

      DELIVERY_SCHEDULE_ID_AT_PRINT_PREVIEW_SELECTOR_SET_TO_FIELD.png

        • 1. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
          GuyStevens

          You are probably referring to an incorrect field or a field from a different Table Occurrence.

          If you have Filemaker Advanced you could use the script debugger and data viewer to find out exactly where it goes wrong.

          Check what table your layout is based on. 
          Check if the field you are setting as a variable is actually the field in that table.
          Check to see if the value you are setting in the other field is the correct variable name.
          Check if the field you are setting the variable in is the correct field in the correct table. 

          • 2. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
            philmodjunk

            Feel free to post your script if you are still unable to solve this.

            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 New Answer.
            2.      
            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.)
            4.      
            5. If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
            6.      
            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.
            • 3. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
              IJ

              Hi PhilModJunk,

              I have a pdf and a script running (with debbug viewer) video record uploaded to dropbox. Could you give me an email to share it with you?

              Tnx,

              IJ

              • 5. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
                GuyStevens

                Hi ij,

                I don't entirely understand your script. I guess you have the need to make invoices if none are there, but I feel like this hasn't been properly implemented because you never really look for the Invoice Id in the Invoices table. You have an if statement that is commented out. That also doesn't really seem right.

                I can't see much in the video because the quality is rather bad and you are also not showing the data viewer.

                First of all you don't need all the "Go To Field" script steps. They can all be removed. Because while setting the variable or setting a field you are specifying there what field you need to be using. So all of the Go To Field steps are useless.

                Second of all, I think there is a problem with your "Set Field" step. It has to much stuff in it. It should be:

                Set Field [ Invoices::Delivery_Sheduled_Id_Nv ; $DELIVINV ]

                But in your script there is some additional reference to the field. That might be messing your step up.

                Try changing that.

                • 6. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
                  philmodjunk

                  I didn't take time to look at your files as Guy gives really good advice without any help from me. But keying in one his comments on your set field step, perhaps this added info on how to set up set field will be helpful:

                  When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Do not click the specify button next to the repetition box. Click OK to close this dialog box. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.

                  • 7. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
                    GuyStevens

                    The funny thing is that there are two Set Field script steps in that script and the second one IS correct. 

                    So I think this might just be an oversight, or a silly mistake.

                    Greetings

                    Guy

                    • 8. Re: Weird: Set any Variable $whatever -> result Set Field = 0 ?
                      IJ

                      Thank you...

                      While coding (coding fatigue...) I made a mistake in the Set Field calculation (and was blind to it...). As Guy said, it should be  "Set Field [ Invoices::Delivery_Sheduled_Id_Nv ; $DELIVINV ]" !

                      Tnx again,

                      IJ