5 Replies Latest reply on Dec 15, 2010 8:46 AM by philmodjunk

    Use pop-up list to go to a specific record

    kolymsky

      Title

      Use pop-up list to go to a specific record

      Post

      Is it possible to use a pop-up list to navigate to a specific record? I have tried to do this but I can only change the data in the field as opposed to navigating there, this is frustrating as it results in duplicating field data into other records.

        • 1. Re: Use pop-up list to go to a specific record
          philmodjunk

          What kind of values are you listing in your pop up?

          In any case, you can define the field you want to set up as a pop up list as a field with global storage. This field will never be used for data entry, just to select the value of the record you want to go to. IF this field were named, gRecordKey, then your script might look like this:

          Enter Find Mode[] // clear the pause check box
          Set Field [ YourTable::RecordKey ; YourTable::gRecordKey ]   // gRecordKey must be defined to use global storage
          Perform Find []

          A script trigger such as OnObjectModify can be selected for you pop up menu so that selecting a value, performs this script.

          Note that this script produces a found set of just the selected record. If you want to keep your found set unchanged and just make the selected record the current record, a different script would be needed.

          • 2. Re: Use pop-up list to go to a specific record
            kolymsky

            I tried to do as you suggested however came unstuck with the script.

            at the

            "Set Field [ YourTable::RecordKey ; YourTable::gRecordKey ]"

            step I couldn't find a way to include "YourTable::gRecordKey" as it would only let me specify one field in the script step options this results in an invalid criteria error message.

            I would like to keep the found set unchanged making the selected record the current record, would this just require and additional script step to show all records or would the script have to be completely different?

            • 3. Re: Use pop-up list to go to a specific record
              philmodjunk

              Set Field has two specify buttons in the lower right corner of the script editor. Select the script step, then click the first button to select "yourtable::RecordKey", then use the second specify button to enter the expression for the value to be assigned to that field, "YourTable::gRecordKey".

              Keeping the found set unchanged would be a completely different script.

              Go To Record [ First ]
              Loop
                 Exit Loop If [ YourTable::RecordKey = YourTable::gRecordKey ]
                 Go To Record [ Next ; Exit after Last ]
              End Loop

              Or a Go To Related Record step can be used to do this without the loop if you define a self join relationship and specify the right parameters, but that's a much more "advanced" approach to doing this.

              • 4. Re: Use pop-up list to go to a specific record
                kolymsky

                Thanks for that, I saw the second specify button but when I hit it and the calculate dialogue came up I could have sworn  it said the expected result was to be a number, thats what you get for trying late at night when you're tiredLaughing

                I got it to work !

                I also thought before I completely redid the whole script I would throw in a show all records step and that did the trick although I did what you suggested.

                Is there any reason a show all step would be a disadvantage in this circumstance, there being no need to filter out any records that is.

                • 5. Re: Use pop-up list to go to a specific record
                  philmodjunk

                  As long as Show All Records doesn't reveal records you don't want shown, there should be no problem.