Announcement

Collapse
No announcement yet.

Multi Select How to?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multi Select How to?

    I'm new to scriptcase and so far the product is really neat.

    I'm building a simple inventory app to learn the program. In the "grid" or "multiple record" form, I'm trying to do a multi select where the same variable (text box) a user types in, will update a certain value for every row checked.

    So in the inventory I have (reduced for clarification):
    ID, Model, Status

    Here is an example of the output:
    1, Mac Air, Deployed
    2, MacPro, Storage
    3, Ipad4, Storage.

    I would like to have a simple text box at the bottom for mass updating the 'status' field. So I would put a check box for each row, for the mac Pro and Ipad4, and type (or select drop down) and click Deployed. It would then edit both rows at the same time and adjust them to 'Deployed', or whatever I chose. While doing 2 at a time, isn't impressive, doing 25 at a time is where this is going.

    I just need some guidance on how to accomplish, some type of "looping through each row" based on a checkbox check or not and slamming a new value in.

    Thanks in advance!

  • #2
    Run Button: http://www.scriptcase.net/forum/show...-into-the-form

    Dave
    Dave Prue
    Code Whisperer
    Lahar International Corp
    www.lahar.net

    Comment


    • #3
      Originally posted by daveprue View Post
      Thanks Dave, this has gotten me very close.

      While the Run button lets the user do one 'function', is there a way to have a user modify a drop down selection and then hit a 'run button' based on that user's drop down?

      In my inventory example... I want to change all inventory items status to 'deployed' from 'storage'. I could make a run button that says "make deployed", and with the code in the background, I could change anything that is check marked to 'deployed' vs. whatever it was.

      However, what if I wanted to have one 'run' button, but there was a manual drop down selector box. So it would give the user options such as "deployed, storage, retired". Then the user would make all things checked, based on what the drop down was. Right now, I'd have to create 3 separate run buttons (one for mark-deployed, mark-storage, or mark-retired). Thanks in advance.

      Aaron

      Comment


      • #4
        Originally posted by pindawen View Post
        Thanks Dave, this has gotten me very close.

        While the Run button lets the user do one 'function', is there a way to have a user modify a drop down selection and then hit a 'run button' based on that user's drop down?

        In my inventory example... I want to change all inventory items status to 'deployed' from 'storage'. I could make a run button that says "make deployed", and with the code in the background, I could change anything that is check marked to 'deployed' vs. whatever it was.

        However, what if I wanted to have one 'run' button, but there was a manual drop down selector box. So it would give the user options such as "deployed, storage, retired". Then the user would make all things checked, based on what the drop down was. Right now, I'd have to create 3 separate run buttons (one for mark-deployed, mark-storage, or mark-retired). Thanks in advance.

        Aaron
        Except I don't understand your requirement fully, you should be able to :

        1) create a field in the form, say 'choice' (that doesn't have any impact on the dbase)
        2) make it a select field with manual options for the 3 choices
        3) make your run button update the relevant dbase field based on the contents in {choice}.

        Comment


        • #5
          I've been playing with this some more.. I guess now I just need a simple tutorial on how to update the database field (for all rows checked).


          I'm a complete newbie on how to insert some type of looping: "update table inventory set status='Deployed' where id = check marked ID" line

          I think once I have an example of a looping DB update command, based on what a user check marked, I will be golden.

          Comment


          • #6
            You need to use sc_exec_sql(" <insert your SQL update statement ");

            (as per macro doc at http://www.scriptcase.net/docs/en_us...os#sc_exec_sql.)

            Comment


            • #7
              Originally posted by scriptcaser View Post
              You need to use sc_exec_sql(" <insert your SQL update statement ");

              (as per macro doc at http://www.scriptcase.net/docs/en_us...os#sc_exec_sql.)
              That seems to do it!

              I'll post back if I have troubles. Thank you so much.

              Comment


              • #8
                Originally posted by pindawen View Post
                That seems to do it!

                I'll post back if I have troubles. Thank you so much.

                Alright, with a combination of sc_select and sc_exec_sql, I am very close to completing this project. The only thing I need now, is how to add a text box to a grid, that does not go on every row.

                I have a grid, with checkboxes to select which records I want to update (via the run button). However, at the bottom (or top), I would like a single text box, which a user can type into. Let's call the text box: status_text_box.

                A user looks at the grid and puts a checkmark next to each row that will receive the same information. The user will then type into the "status_text_box" a value such as "almost ready". The user then hits the customized run button, which will update all the rows with a checkbox, with the value of "almost ready".

                So how do you create a text box, (and later on, a calendar selector box) to show up on the page, so I can enter data once, and have it 'mass' update certain rows via the run button? I have been using a simple grid. Should I try do some type of container /tab thing?

                Comment


                • #9
                  Originally posted by pindawen View Post
                  So how do you create a text box, (and later on, a calendar selector box) to show up on the page, so I can enter data once, and have it 'mass' update certain rows via the run button? I have been using a simple grid. Should I try do some type of container /tab thing?
                  As a layman, I can think of 2 possible ways.

                  1st way: embed you grid in a single page form. The single page form has the selector box that changes a global variable (e.g. ([selection]) by ajax event. The run button then uses the contents of [selection].

                  2nd way: put some html5/jquery in the onHeader event to send the selector functionality to the screen above the core grid. I'm however not sure how to access the javascript variable set from within SC code...but some more experienced folks can help on that bit.

                  Comment

                  Working...
                  X