5 Replies Latest reply on Mar 25, 2013 1:54 PM by willem67

    script set field with value list

    willem67

      Title

      script set field with value list

      Post

           I have a field with a value list to choose various lay-outs. That works well.

           But if I move from one lay-out to another via GTRR (Go to related record) it does not modify the field for choosing lay-outs. It keeps showing the name of the previous lay-out.

           I have made a set-field script for a script trigger when entering the lay-out to set the field with the correct name of the lay-out. But it only opens the value list after entering the lay-out; it does not actually select the value as defined in the script.

           Any suggestions?

           Willem

            

            

            

            

        • 1. Re: script set field with value list
          philmodjunk

               What kind of field? Does it have global storage specified?

               Set Field should update the value of the field as you want here, but it may not work as expected if you aren't using the same global field on both layouts.

               If that doesn't do it, post the script where the set field is supposed to modify the field's value.

               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.
          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.
          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.
          • 2. Re: script set field with value list
            willem67

                 Yes, it has global storage specified. But I will explain the situation more detailed:

                 I have five related tables. Every table has one main layout. I would like to switch regulary from one lay-out to the other. I created one field with a valuelist with terms for every lay-out and I use a script to go to the appropriate lay out if selected. [see screenshot]. That works well.

                 But, if I go to another lay-out via GTRR, the field with the valuelist does not update to the value of the lay-out of the related record. I thought I should use a script like 'set field' to set the value to the one of the selected layout. I tried, but it changed the field to 0 or to 1. [see screeeshot].

                  

                  

            • 3. Re: script set field with value list
              willem67

                   and this is the other script...

              • 4. Re: script set field with value list
                philmodjunk

                     I don't speak your language but It looks like you are using Go To Layout, not Go To Related Record--which would be Ga naar gerelateeerde record, if I am picking the correct step out of the list on the left of your last screen shot.

                     But whether you use go to layout or go to related record, you'd need to add a set field step such as:

                     Set Field [YourTable::YourLayoutNamefield ; Get ( LayoutName ) ]

                     to update this field. It won't happen automatically.

                • 5. Re: script set field with value list
                  willem67

                       That works very well! Thank you very much!