How do i avoid re-minising the value through a button when i click ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rohullah amiree

    How do i avoid re-minising the value through a button when i click ?

    Hello
    I have problem with the following table
    For example i have two tables Stock,Income

    stock table columns
    Date,itemid,ite mName,ItemType, Tons.

    Income table columns.
    Date,ITemid,ite mtype,tons.

    Now i want minus income.tons from stock.tons
    by when-button-press trigger.
    ------------------------
    Declare
    Begin
    UPDATE Stock set stock.tons=:sto ck.tons-:income.tons
    where itemid=:income. itemid;
    commit_form;
    go_block('Stock ');
    execute_query;
    go_block('incom e');
    execute_query;
    end;
    ----------------------------
    the problem is when i click the button it minus income.tons from stock.tons, But when i click the button again It minus The same value and so on.

    So how to provent to minus the same Record value from the same Record again and again,it should minus it once per record.

    Send me the proper and complete CODE,
    I really need it.
    Thanks in advance.
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Thats as expectd. You have included the update statement in Button-press trigger and every time a button is pressed, the update happens and is COMMITED.

    In order to handle multiple updates, you will need to flag the record by using an additional Flag column, and before doing an update, just check the flag, if it is unflagged then update else don't update the stock table.

    Comment

    Working...