Announcement

Collapse
No announcement yet.

Read the content of a Grid in a php button

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

  • Read the content of a Grid in a php button

    I would like to read all the lines of a Grid in a php code (button).

    Is there a global var available ? an array ? in order to do an foreach loop on all the lines ?

    I use to play with the run button, but now I need to call my code for all the lines (More than 100 000 lines).

    Please help me if you know, or give me a piece of code.

    Thank you in advance.

    Laurent.


  • #2
    You can work on your grid with the Run button. The Run button has 2 events: OnRecord: Executed on each selected record.
    Image2: PHP Code Interface. OnFinish: Executed after process all selected records.


    Image3:PHP Code Interface

    You can get more information in the Web Help that Scriptcase has and also there is a sample with tutorial in the scriptcase website.

    Hope this helps.

    Comment


    • #3
      Thank you, but as i said before, i can't use the OnRecord, because OnRecord only works with checked line on a single screen.

      As i have lots off lines, i need to use the OnFinish but i don't know if there is a global $var like an array I could use the parse.

      I saw the tutorial but it's not usable in my case (i need to parse all line of the grid filtered with numbers affinity parameters).

      Have you any other ideas ?

      Comment


      • #4
        If you need the lines of the current grid then the only way (afaik) is to use onrecord and store the record in a (global) array.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          I do not know exactly what you are trying to accomplish but if I would need to work on on all the lines of a grid. like a batch update of a field, I have used stored procedures. I add a PHP button and I call the stored procedures from inside that button.

          Comment


          • #6
            PHP Code:
            // PASTE HERE YOUR BASE SQL FOR THE GRID

            $grid_qry 'SELECT
                id,
            FROM
                yourtable'
            ;

            // WE ADD IF THERE IS SOME FILTER APPLIED
            if ($sc_where_current) {
             
            $grid_qry .= ' ' $sc_where_current;
            }

            // THROW THE QUERY AND USE YOUR DATA
            sc_lookup(arrmygridcontent$grid_qry);
            if (isset(
            $arrmygridcontent[0][0])) {
                
            // iterate over your grid content.

            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment

            Working...
            X