No announcement yet.

Batch Processing

  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch Processing

    I looked through the examples and I can't find what I'm looking for. I need some kind of batch processing utility.

    For instance: I want to read a file between one date and another, then depending on a field value, create a new record in another file.

    Does this require code?

  • #2
    Hello townsend:

    What you are looking for is a conbination of PHP code and CRON tasks (if you use Linux) or Task Scheduler (if you use Windows). Remember that you can schedule a task to run a php code for example:

    In windows Task Scheduler you program a task to be executed everyday at noon to run the following command

    PHP.exe <Path to my applications>\MyApp\Myapp_apl.php

    That will execute the code inside myapp_apl.php

    Hope this helps..



    • #3
      You can do it in several different ways (where is the file? you have to upload? are you on a control app? a form? a grid? and so on....

      But the main idea is, on an event/button/blank application (again, it depends on your situation), you:
      (I assume you are trying to read a CSV file)
      PHP Code:
      $fichero=fopen("../kogestdata/PRODUCTO.csv""r"); //open your file
      $n 1;
      // Taking the values from the file into vars
      // Create a query string
      $query "INSERT INTO tpvproducto(nombreProducto, departamentoProducto, codigoBarras, refProducto, stockTeorico, iva, guuid) VALUES ('" .$nombreProducto."',".$departamentoProducto.",".$codigoBarras.",".$refProducto.",".$stockTeorico.",".$iva.",'".$guuid."')";
      // throw the query against the database   
      // close the file

      Professional Scriptcase Services
      Some Customers opinions


      • #4
        In addition to Giu's answer, it might depend on the size of the file to process. If the file is too large then you might need to load the file in chunks to prevent running out of php runtime limits; or be able to set your php defaults.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development /