No announcement yet.

Best way of action on records found by a user via search in a grid application

  • Filter
  • Time
  • Show
Clear All
new posts

  • Best way of action on records found by a user via search in a grid application

    I have a grid application where users typically will use advanced or dynamic search to select subsets of records and mark them for various processing to be done. My plan is to have some extra buttons which will lead to new applications where the user can specify what kind of processing is to be done. However, how can one identify the records that the user have searched in the grid?

    Are the search criteria available as variables?

    Or perhaps there is already a prepared PDO select statement that I can access, so that I don't have to build it up again (although that is easily done).

    I have seen that there are some macros, which can be used for getting a dataset variable for a select query using the existing connection. But is there a way to access just the PDO object, so that you can use the existing connection in PHP in any way you may wish?
    Last edited by Orion; 06-23-2015, 05:19 AM.
    Best regards,


  • #2
    One solution could be to add a run button so that users can pick all or a subset of the recordset resulted form the search.
    When the run button is executed you can put all selected records IDs in an list or array and pass it to any other app.
    In the target app the select can simply have the following where clause:
    ... where id IN ('id1, 'id2', 'id3', etc.);


    • #3
      Yes, I already have the grid application in place and I have added buttons for the various kinds of processing that the user may select against the records he/she selects using the advanced filter. However, the subset of records selected for the processing can be from a few that can be seen in the screen up to several hundreds or perhaps even thousand (out of the whole total set of records, which may be several tens of thousands).

      Thus I was thinking that it may be easier to just prepare a new select statement with the criteria that the user entered in the advanced search of my grid app to select the records that need to be processed in the processing application that is called from the action button in the main grid application. The user will never just hand pick records one by one, but rather select a whole segment using the criteria fields of the advanced search form that automatically is part of the grid application.

      If there is already a variable with rowids of all records that are presently selected (i.e. they match the criteria given in the advanced search form), I can of course just call my processing application with that variable as a global variable. However, given that there may be quite many records, and that the basis of the grid is a view rather than a table, I think that perhaps it is easier to just prepare a new select statement and loop through the records.

      By the way, I know that I am new to SC so if how to do this is already described in the documentation somewhere or there is a video with the information, just point me to it.
      Best regards,



      • #4
        It may not work or be the worst possible solution...:

        Grid - OnHeader event

        [gridSQLwhere] = {sc_where_current};
        // summary "filters" overides the current_filter and are handled differently
        if (!empty($_POST["nmgp_parms_where"])) {
        	[gridSQLwhere] = str_replace("?#?","=",$_POST["nmgp_parms_where"]);
        Set [gridSQLwhere] as OUT


        • #5
          Yes, {sc_where_current} and the handling of the parameters looks like the way to go...
          I will experiment and see if it can work.

          Thanks a lot for the input!!
          Last edited by Orion; 06-23-2015, 01:41 PM.
          Best regards,