unchecked selected field on form

hello Guys,

I am trying to uncheck a field on a form by button, I wrote this code on form but I am afraid  it will uncheck all field's value on the table, but I just want to uncheck and empty only selected row's field How should I write this code?

I  created button and Wrote on clicked method:

VendPaymentPlanLineByDue tempVendPaymentPlanLineByDue,__VendPaymentPlanLineByDue;

super();
ttsbegin;
if(__VendPaymentPlanLineByDue.LedgerJournalId !="") 
{
select forupdate tempVendPaymentPlanLineByDue where tempVendPaymentPlanLineByDue.RecId == __VendPaymentPlanLineByDue.RecId;


tempVendPaymentPlanLineByDue.Sended = NoYes::No;
tempVendPaymentPlanLineByDue.VendPaymenytPlanFilePath = "";   // only the red fields I want to get empty on selected row
tempVendPaymentPlanLineByDue.doUpdate();
}
ttscommit;

  • smoch9339
    elect forupdate tempVendPaymentPlanLineByDue where tempVendPaymentPlanLineByDue.RecId == __VendPaymentPlanLineByDue.RecId;

    You need to be using the table name used in that form instead of declaring it as _VendPaymentPlanLineByDue.

    Also try moving it to the table method and call it in button clicked event.

  • In reply to Kranthi:

    void clicked()
    {
    VendPaymentPlanLineByDue tempVendPaymentPlanLineByDue;

    super();
    ttsbegin;
    if(tempVendPaymentPlanLineByDue.LedgerJournalId !="")
    {
    select forupdate tempVendPaymentPlanLineByDue;


    tempVendPaymentPlanLineByDue.Sended = NoYes::No;
    tempVendPaymentPlanLineByDue.VendPaymenytPlanFilePath = "";
    tempVendPaymentPlanLineByDue.doUpdate();
    }
    ttscommit;
    }
    I should write like tihs?

    this sended field use in 2 table's method actually .

  • In reply to smoch9339:

    smoch9339
    if(tempVendPaymentPlanLineByDue.LedgerJournalId !="")

    This will not work, you just declared it above in that method.

    Use the data source/table name used in the form data sources.

    smoch9339
    select forupdate tempBuzVendPaymentPlanLineByDue;

    This will select first record in that table (based on the RecId/related index). You are not telling your code which record you want to update.

  • In reply to Kranthi:

    my real problem is how can select the row that I want to uncheck fields
    select forupdate VendPaymentPlanLineByDue; whatshould I wrote on where to do this?

    okey I am gonna use the datasource's tabla name and I think my if sentence is wrong also,if(tempVendPaymentPlanLineByDue.LedgerJournalId !="") I am not gonna use this cuz ıt does not make sense but

    I dont know how can I unchecked the only selected row's fields.How should I wrote a select for this.
  • In reply to smoch9339:

    If VendPaymentPlanLineByDue is your data source name,

    if (VendPaymentPlanLineByDue .LedgerJournalId !="")
    select forupdate tempVendPaymentPlanLineByDue.RecId == VendPaymentPlanLineByDue .RecId;
  • In reply to Kranthi:

    void clicked()
    {
    VendPaymentPlanLineByDue tempVendPaymentPlanLineByDue;

    super();
    ttsbegin;

    I delete the if line cuz It wrong statement for my case.

    select forupdate tempVendPaymentPlanLineByDue.RecId==VendPaymentPlanLineByDue.RecId;


    tempVendPaymentPlanLineByDue.Sended = NoYes::No;
    tempVendPaymentPlanLineByDue.VendPaymenytPlanFilePath = "";
    tempVendPaymentPlanLineByDue.doUpdate();
    }
    ttscommit;
    }

    Lastly its like this right?
  • In reply to smoch9339:

    It looks like. Is that not working?
  • In reply to Kranthi:

    no unfotunately in select gives an error syntax .....I think cuz of this line vendPaymentPlanLineByDue.RecId; its ax 2009 I tried everything to solve it, like I insert ; before super also I turned the vendpaymentplanlinebydue to element like tihs........but only says syntax error
  • In reply to smoch9339:

    Missed the syntax.

    select forupdate tempVendPaymentPlanLineByDue
    where tempVendPaymentPlanLineByDue.RecId==VendPaymentPlanLineByDue.RecId;

  • In reply to Kranthi:

    thank you so much kranthi you seved my day again
  • In reply to Kranthi:

    seriously last question:)How can I refresh the form after using the button.without using F5?
  • In reply to smoch9339:

    VendPaymentPlanLineByDue.executeQuery() or VendPaymentPlanLineByDue.refresh or both
  • In reply to smoch9339:

    VendPaymentPlanLineByDue_ds.reread();
    VendPaymentPlanLineByDue_ds.refresh();
  • In reply to Kranthi:

    it does only in form,also I want to refresh the datasource's so should not use VendPaymentPlanLineByDue_ds.exequtequery instead of VendPaymentPlanLineByDue_ds.refresh();?
  • In reply to smoch9339:

    sorry at fisrt I wrote only form's but after try I realize the table's is not refresing either
Related
Recommended