Announcement

Collapse
No announcement yet.

Run grid button

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

  • Run grid button

    I have a grid from table "numbers". Only to get an X amount of records.

    On the onRecord event I wrote the code:

    [date] = date('l d F Y', strtotime([date] . ' +1 day'));
    {date} = [date];

    So, now I have a grid with dates from tomorrow until 1 year later.

    With this tutorial "http://www.scriptcase.net/fr/samples...rid/grid44.php" I created the grid buton and that works fine.

    I'd like to insert a record with the date(s) I selected. But I'll alway get the last dat of the grid.

    This is my code in the OnRecord form the button:

    $arr=[i];
    [arr_vl][$arr]={number};
    [i]++;

    // SQL statement parameters
    $date = date('Y-m-d', strtotime([date]));
    $TimeStamp = date("Y-m-d H:i:s");
    $insert_table = 'tb_shifts_main'; // Table name
    $insert_fields = array( // Field list, add as many as needed
    'timestamp_insert' => "'$TimeStamp'",
    'author_insert' => "'1'",
    'author_update' => "'0'",
    'active' => "'1'",
    'status' => "''",
    'lock_record' => "'1'",
    'date' => "'$date'",
    'location_id' => "'1'",
    'contact_id' => "'1'",
    'memo' => "'$test'",
    'info' => "''",
    'description' => "''",
    );

    // Insert record
    $insert_sql = 'INSERT INTO ' . $insert_table
    . ' (' . implode(', ', array_keys($insert_fields)) . ')'
    . ' VALUES (' . implode(', ', array_values($insert_fields)) . ')';

    sc_exec_sql($insert_sql);



    And this in the OnRecord event:
    [date] = date('l d F Y', strtotime([date] . ' +1 day'));


    How do I insert the selected date?

  • #2
    Found it! Moved the insert code to the onRecord event. Sorry!

    Comment

    Working...
    X