AnsweredAssumed Answered

1 Button - 2 Scripts?

Question asked by Dekade on Sep 27, 2012
Latest reply on Sep 27, 2012 by schamblee

Title

1 Button - 2 Scripts?

Post

      

Question: Can 1 button function as a switch (so to speak) by performing 2 scripts?

      

Here is my reasoning:

      

         
  1.           I have a “MAIN” database – ‘original layout’ with a “Selected Categories” portal as a join
  2.      
  3.           Each row of the “Selected Categories” portal represents a record from a “Categories” database           
                     
    1.                     There may be 50 {+ or –} rows thus representing 50 {+ or -} records from the “Categories” database
    2.           
         
  4.      
  5.           A “Selected Categories” portal row consists of the following:           
                     
    1.                     A related “Categories” field called ‘Category Topic’
    2.                
    3.                     A “Selected Categories” field called ‘Topic Count’; the ‘Topic Count’ field is to show how many different total records in the “MAIN” database have used each “Selected Categories” rows’ specific ‘Category Topic’.
    4.                
    5.                     A “MAIN” database button – Described in 4) as follows:
    6.           
         
  6.      
  7.           The row button I hope could function as follows:           
                     
    1.                     Click 1st time – perform a script that creates a “Selected Categories” record with info about the portal row                     
                                 
      1.                               The created record will fill in a field in the “Selected Categories” database with the respective portal rows’ related ‘Category Topic’.  (lets say the topic is – DOGS)
      2.                          
      3.                               Then also in the “Selected Categories” database there is a ‘Total Usage’ field that shows how many records total in the “MAIN” database are there that have chosen DOGS
      4.                          
      5.                               The new ‘Total Usage’ field count is then displayed in the “Selected Categories” portal row ‘Total Usage’ field.
      6.                          
      7.                               The button now turns BLACK in color; the button was originally CLEAR in color.
      8.                     
                     
    2.                
    3.                     Click 2nd time – perform a script that erases the record created by the first click and turns the button color back to CLEAR; indicating that my mind has been changed about associating DOGS to the given “MAIN” record.
    4.           
         

      

     Summary:

      

     Multiple rows can be selected in the “Selected Categories” portal for each “MAIN” database record. Thus the portal will display via the BLACK colored buttons which ‘Category Topics’ have been associated with the respective “MAIN” database record.

      

     So, that’s what I want to accomplish with one button.

      

     I’m fairly certain (but not totally) that I can create all necessary script lines except for the lines that would make the button perform 2 different scripts. Those lines are where I need the help. However, any ‘all encompassing lines’ help would be greatly appreciated.

      

If one button cannot function the way that I am wanting then what might be the alternative solution? Maybe two buttons – one button would create the record and one button would erase the record? How would I make the create button turn black in color and then both buttons to be clear colored to erase the record? I think the erasing would be a calculation but I can’t perceive what the calculation would be.

      

     Thanks for any input,

      

     Dekade

      

      

Outcomes