3 Replies Latest reply on Feb 13, 2012 8:48 PM by philmodjunk

    Need help making buttons with dedicated item functions....

    fotoboy

      Title

      Need help making buttons with dedicated item functions....

      Post

      Hi Thanks in advance....
      first off...I'm a classic right brainer and databases mess with my mind...

      that said, I am trudging my way through a revamp of the Lending Library starter solution... 

      long story short, I have a very small collection of items that I want to be able to check in or out by buttons dedicated to each item... the database is mostly being used for tracking of these items to what went to who and when it came back...

      so... I have an Item 1 button, I press it and the item gets checked out to whoever I choose... logged and done
      item 2 button does the same...

      this seems like it would be simple, and I believe it would be... I just cant figure out how to write (or modify) the script to pull up a particular item when the button is activated... I plan on using this or similar script to get that job done... it is working fine for the asset ID that is on the particular layout that it is working on now, but I need all of the buttons on one layout...



         

      Screen_shot_2012-02-12_at_5.56.03_PM.png

        • 1. Re: Need help making buttons with dedicated item functions....
          philmodjunk

          You'd need the button's script to look up the asset in question before line 1 of the above script executes. Your button could pass the asset ID as a script parameter and then get ( ScriptParameter ) can extract the asset ID passed to it. This can allow you to modify the script to work with both buttons dedicatd to a specific asset ID or a Generalized one that works from the asset ID of the current record. (Don't specify a script parameter for the generalized button.)

          I'm not looking up the actual starter solution here so I may not have the exactly correct field name:

          Set Variable [$AssetID ; Value: Get ( ScriptParameter ) ]
          If [Not IsEmpty ( $AssetID ) ]
             Enter Find Mode []
             Set Field [Assets::AssetID ; $AssetID ]
             Perform Find []
          End IF
          If [Assets::Status = "Not available"]

          • 2. Re: Need help making buttons with dedicated item functions....
            fotoboy

            Hi PhilModJunk...

            thanks for the reply...

            I'm not understaning a thing or two... man I'm more novicer than I had thought (or hoped)

            where does the value come from that I am to feed to the script? (the Item number (Asset ID))  I just want that to be in the script...

            something like....

            set asset ID to 777

            proceed with script...

             

            (is that the Set Field?)

            thanks again...

            • 3. Re: Need help making buttons with dedicated item functions....
              philmodjunk

              where does the value come from that I am to feed to the script?

              You indicated that you wanted each button to work with a specific asset ID, correct? In button setup, when you click perform script as the button option and click specify to select the script to be performed, you get a dialog box with a text box labeled "Optional script parameter". You'd enter the asset ID there so that clicking this button passes the same Asset ID to the script as a script parameter. Get ( ScriptParameter ) then extracts this value so that your script can use it.

              You would then either create a new record to log the fact that the asset was loaned out, or find and update an existing record to log the fact that it has been returned. The example script performs a find, but it probably needs to specify an additional criterion to find the record where the asset was loaned out but which has an empty date returned field so that it only finds the most recent record for this asset ID.