10 Replies Latest reply on Apr 12, 2012 2:53 PM by Mike_Mitchell

    Changing a ValueList

    benniemc

      Can I have a ValueList point to a specific field to obtain its values, then change the values in that field, resulting in a change in the ValueList items? It seems that the ValueList stores the items (indexing required). Is there a way to refresh the ValueList, or its index?

        • 1. Re: Changing a ValueList
          Mike_Mitchell

          Bennie -

           

          If you base a value list on the contents of a field, it will build the list based on the index (as you note). The only circumstance I'm aware of that would cause the list not to update when the field contents change would be if the change had not yet been committed. Can you elaborate a bit on the specifics? What are the conditions where you're seeing it not update?

           

          Mike

          • 2. Re: Changing a ValueList
            benniemc

            The return-delimited values of a field upon which the ValueList is based is set by a script depending upon the value of the entry in another field... only the items do NOT change? I hope you understand, and I realize this is very confusing. Any help you can offer will be appreciated.

            • 3. Re: Changing a ValueList
              Mike_Mitchell

              Bennie -

               

              If I understand correctly, you're saying there's a script that updates the field on which the value list is based?

               

              If that's correct, are we certain the script is running? What triggers it to run?

               

              Mike

              • 4. Re: Changing a ValueList
                benniemc

                I have a field named "Assigned" with an OnObjectExit script that excutes everytime the field is exited. The script examines the "Assigned" field's contents and sets another field "LocationList" to a list of return-delimited values specific to the "Assigned" field's contents. Unfortunately, even though I can confirm through the Script Debugger that this script is actually run, the ValueList items do NOT change.

                • 5. Re: Changing a ValueList
                  Mike_Mitchell

                  Are these fields both in the same table? How are you setting the values in LocationList? Seeing you use "ValueList" makes me think you may be improperly using a function (perhaps Get ( ValueListItems ))?

                  • 6. Re: Changing a ValueList
                    benniemc

                    Perhaps. I'm always pushing the envelope.

                     

                    Here is the script that sets the field "LocationList" used for the ValueList...

                     

                    // The field Inventory::LocationList initially contains a list of staff all prefixed with "-"

                         If [Left(Inventory::Assignment;1) = "•"] // if the prefix of "Assignment" field is "•"

                              Set Field [Inventory::Location; "On Truck"]

                              Set Field [Inventory::LocationList; "On Truck¶On Rig¶"]

                         Else

                              Set Field [Inventory::Location; Preferences; Today] // inserts today's date

                         End If

                         If [Left(Inventory::Assignment;1) = "-" or Left(Inventory::Assignment ;1) = "•"] // strip prefixes

                              Set Field [Inventory::Assignment; Middle (Inventory::Assignment ; 2 ; 99)]

                         End If

                     

                    I use the "-" and "•" to prefix certain items so that they will sort correctly in the ValueList. They are stripped out in the final steps. Hope this helps.

                    • 7. Re: Changing a ValueList
                      Mike_Mitchell

                      And what are you basing the value list on? LocationList? What change are you expecting?

                      • 8. Re: Changing a ValueList
                        benniemc

                        Mike...

                         

                        Thanks for your help. I had to leave the forum. I'll be back tomorrow. Sorry.

                        • 9. Re: Changing a ValueList
                          benniemc

                          I'm back. I assemed that the ValueList should be empty when the field LocationList is set to empty. Evidently not.

                           

                          I've since discovered a workaround, but thanks for your help.

                          • 10. Re: Changing a ValueList
                            Mike_Mitchell

                            Bennie -

                             

                            A value list based on a field will be based on all records that meet the criteria set in the value list (i.e. either all records in the table or all records that match the relationship). It won't be based on just the current record unless you make a self-joining relationship that matches only the current record. And if it IS empty, it'll say something like "<no values>" (I forget the exact terminology right now).

                             

                            Glad you found a workaround.

                             

                            Mike