4 Replies Latest reply on Jun 29, 2011 1:03 PM by RossStewart

    Using buttons in a list

    RossStewart

      Title

      Using buttons in a list

      Post

      Heres the basics of what I want to do

      LAYOUT 1(data from TABLE1)

      FIRST UNIT

      SECOND UNIT

      THIRD UNIT

      LAYOUT 2 (A listview LAYOUT genrated by a find request. When layout opens showing in this example 3 results)

      UNIT       NAME         LOCATION      (my button)

      UNIT       NAME         LOCATION      (my button)

      UNIT       NAME         LOCATION      (my button)

      If twelve results where available there would be 12 buttons.

      OK, how do I get each button to copy the data from its respective feild"UNIT" to a feild in TABLE1

      It always seems to send the feild from the last record in the list...

      Please help!!!

        • 1. Re: Using buttons in a list
          philmodjunk

          In Layout 1, does First Unit, Second Unit, Third Unit, etc. represent a list of records in a table with one record for each unit? If so, you should change your design to set it up that way or you could use a drop down list of units with a script trigger to take the selected unit name and use it to perform your find. The script is essentially the same in all cases.

          I'll assume you have a list of records here, which gives you just one button, but it's repeated for every record on your layout:

          Set Variable[$Unit ; Value: Table1::Unit]
          Go to Layout [Layout 2]
          Enter FInd Mode [] //clear the pause check box
          Set Field [Table2::Unit ; $Unit ]
          Set Error capture [on]
          Perform Find[]

          • 2. Re: Using buttons in a list
            RossStewart

            LAYOUT 1(data from TABLE1)

            FIELD A     FIELD B    FIELD C

            LAYOUT 2 (A listview LAYOUT genrated by a find request. When layout opens showing in this example 3 results)

            UNIT(RUSSIAN)      NAME         LOCATION      (my button)

            UNIT(GERMAN)       NAME         LOCATION      (my button)

            UNIT(FRENCH)       NAME         LOCATION      (my button)

            The script I wrote sets a global variable which I use like a pointer when layout 2 is called. So when (my button) is clicked it will send the data to either field A, field B, or Field C. <<<<this part works>>>

            For example, I want to copy the value "GERMAN" to FIELD A. 

             No matter which button I click FIELD A will have FRENCH copied to it.<<<this part doesnt work!>>>>

            I hope that clarifies the situation a little, thanks for your help. Ross

            • 3. Re: Using buttons in a list
              philmodjunk

              I'm trying to reconcile what you describe in your first post with what you describe in your second.

              Field A, Field B, Field B store "First Unit" , "Second Unit", "Third Unit" ?

              My script isn't designed to work from such separate fields but rather from the same field with those values in different records. To me that's a more logical structure here for you data.

              Using Different fields, you'd need to pass the value of the field to your script as a script parameter otherwise, you'll get the same result from each button click.

              The fields themselves can even be set up as the button to be clicked here.

              Go to Layout [Layout 2]
              Enter FInd Mode [] //clear the pause check box
              Set Field [Table2::Unit ; Get ( ScriptParameter ) ]
              Set Error capture [on]
              Perform Find[]

              The button for Field A performs this script, passing the contents of Field A as the script parameter. The button for Field B performs this script, but passes the contents of Field B as the script parameter and so on...

              • 4. Re: Using buttons in a list
                RossStewart

                Just discovered all the Functions. All is good now. I appreciate the help. thx.

                Ross