This topic is locked

get default value for detailfield from masterstable

3/1/2018 10:58:37 AM
PHPRunner Tips and Tricks
R
roeland author

Hello everyone!
I am breaking my head about probibly a simple question for people with scripting knowledge:-)
I have a dashboard that displays

  • the mastertable (view) "orderview"
  • the details table(view) "orderinhoudview"
    When I click on an order in the mastertablelist, I can add or change details from that order in the details lists via inline add.This is working fine, except that I would like to retrieve the value from the mastertable-field "orderrebate" and put as default in the field rebate in "orderinhoudview"
    I tried the explanation from another forumitem in a 100 ways, but I can't get it working. When I make a static session in the orderview table and store it as a default in the orderinhoudview table, it works fine, but as soon as I try to get the field value from orderview table, I get no value in the session.
    T/he last thing I tried is the below code in the orderviewtable. I hope someone wants to look at this and tell me what I am doing wrong here. (It might be multiple things :-))
    -------

    global $dal,$orderview;

    if ($_SESSION[$orderview."id"])

    {

    $rstmp = $dal->orderview->Query("orderrebate=".$_SESSION[$orderview."id"],"");

    $datatmp = db_fetch_array($rstmp);

    $_SESSION["orderrebate"] = $datatmp["orderrebate"];
    }

    ---
    thanks a lot already for your response. By the way, the reaon I want to do it this way, is that the customer has a standard rebate, for example 0 or 50%, but sometimes, separate items on an order should also have different rebates. Therefore I wantto be able to change the default value
    Thanks already for your responses!