This topic is locked

Adjust Import page with Custom data

2/10/2012 7:20:04 AM
PHPRunner General questions
I
Ivan van Oosterhout author

Adjust Import page with Custom data:
Dear all,
I want to adjust my import page with 3 text boxes that can be filled with text by customer and then they select the excel file that imports everything.
My excel file looks like this:

Po_No Po_Version Debtor No Debtor Name Seasoncode Shipmode Etd Eta Agent Vendor Coo Fdd User ID
I want to create 3 textboxes for these columns: Debtor No, Seasoncode, Fdd

Customer fills in the text in these boxes and this data must be imported also in the database to the three columns.
Is this possible and can somebody point me to a solution, because i dont know the answer how to think...
Kind regards,
Ivan

J
Jane 2/10/2012

Ivan,
you need to create add page where user can enter Debtor No, Seasoncode and Fdd values. For example create dummy table with these three fields, set up add page, save entered values in the session variables and redirect to the corresponding import page in the Before record added event on the Eventstab.

You can check saved session variables in the Import page: Before record inserted event and save it in the $values array:

$values["Seasoncode"] = $_SESSION["Seasoncode"];



More info:

http://xlinesoft.com/phprunner/docs/before_insert_record.htm

I
Ivan van Oosterhout author 2/11/2012

Thank you,
I have made it with your instructions, thank you for pointing me in the correct direction...
This is to share with others who also dont know:

  • Made one table with 3 fields
  • Made Add Import page
  • Made in Import events:
    function BeforeAdd($values,$message,$inline)

    {

    $_SESSION["debtor_no"] = $values["debtor_no"];

    $_SESSION["Seasoncode"] = $values["Seasoncode"];

    $_SESSION["fdd"] = $values["fdd"];

    return true;

    }
    function AfterAdd($values,$keys,$inline)

    {

    header("Location: PurchaseOrders_import.php");

    exit();
  • Its been redirected to the correct Import page
  • Made code in Import Events
    function BeforeInsert($rawvalues,$values)

    {

    $values["debtor_no"] = $_SESSION["debtor_no"];

    $values["po_seasoncode"] = $_SESSION["Seasoncode"];

    $values["po_fdd"] = $_SESSION["fdd"];

    return true;

    }
    function AfterImport($count,$skipCount)

    {

    unset($_SESSION["debtor_no"]);

    unset($_SESSION["Seasoncode"]);

    unset($_SESSION["fdd"]);

    }
    I had really great Help with Debug with Variables: http://www.asprunner.com/forums/topic/14035-debugging-with-session-variables/

    With this piece of code you can see if your vaiables are filled with the correct data....
    Thanks,
    Kind Regards
    Ivan