5 Replies Latest reply on Aug 6, 2013 2:01 PM by philmodjunk

    lock value list



      lock value list


           I have a value list in a layout and when I choose a value from it: name of the factory, it displays all the models from the factory that then I can add to the order. Is there any way after initial selection of the factory to lock the value list and not be able to change the selection until creating a new record?


           Thank you for your help!

        • 1. Re: lock value list

               It would not be impossible to do, but would require some careful scripting to handle all possible scenarios. You'd have to design your interface so that users have to click a button to add a new record. That way a script can both create the new record and clear the value in a global variable.

               A script trigger on the field with the value list of factories could check for the presence of a value in that variable to determine whether the user is allowed to select a different value. If the variable is empty, set a value to it and allow the user to change the value. If the value is not set, keep the user from changing the value.

               There are two additional details that will require careful handling:

               Some value list formats such as pop up menus permit selecting a value before the OnObjectEnter trigger performs a script. If you find this is happening, you have to pass the value of the field as a script parameter to capture the original value so that your script can reset the field back to it if the user is not allowed to change the value.

               I can think of situations where a user would need to cancel out of this process and select a different value in the list. Perhaps they selected the wrong factory by mistake. You'd need to provide a button with a script that also clears the global variable to permit them to cancel out of this process.

          • 2. Re: lock value list

                 We have a button to add and another to delete records. Can you explain what you mean by "clear the value in a global variable"?

            • 3. Re: lock value list

                   Set Variable [$$ListLock ; Value: "" ]

              • 4. Re: lock value list

                     We already have an add ana a delete button for our page but the add order script does not work off of a global value ... the on record load script assigned to the layout on the other hand does. Attached is our script and layout ... I have been trying to lock the list but i haven't gotten the result I am looking for. Do you have any other advice that could help me? Thank You!

                • 5. Re: lock value list

                       It does not appear that you are following my suggestions. I can't really figure out what the script is trying to do as the steps do not make sense to me.

                       There is no global variable in the script that you show. The variable is local and does not retain a value after the script terminates and you have a set field step that does not assign a value to a field, plus you change layouts twice, but nothing takes place in between. Does that trip a script trigger that performs a script? I'd need to see that script as well if that is the case.

                       Normally, a script to create a new related record looks like this: (I am using generic names, subsitute actual names from your tables and fields)

                       Set Variable [$ID ; ParentTable::PrimaryKeyField ]
                       Go to Layout ["RelatedTable" (RelatedTable) ]
                       New Record/Request
                       Set FIeld [ RelatedTable::ForeignKeyField ; $ID ]
                       Go To Layout [Original Table]

                       To add a step that sets a global variable to lock the value list field against changes, add one more step:

                       Set Variable [$$Lock ; value: True ]

                       This step can be added anywhere within the above scritp.script.