Update Table

Hello All,

I have a RunBaseBatch class where I am calling a table ABC and inserting a record.

till here everything is working fine but now I want to update a record in this table

any idea how to do it???

I am trying this following code snippet

if(value1 == table_needs_to_be _updated.Value1 &&

value2 == table_needs_to_be _updated.Value2)

{

ttsBegin;

table_needs_to_be _updated.selectForUpdate(true);

table_needs_to_be _updated.Value1= someValue;

semesterCost.update();

ttsCommit;

info(“Same Records cannot be Inserted”); /// if same record is inserted again.

}

Please advice

Hi

select forupdate table_needs_to_be _updated

where table_needs_to_be _updated.value1 == value1

&& table_needs_to_be _updated.value2 == value2

if (table_needs_to_be _updated)

{

ttsbegin;

table_needs_to_be _updated.value1 = somevalue;

table_needs_to_be _updated.doupdate();

ttscommit;

}

pls try this code if it’s resolve your issue dont forget to verifed solution

You have to select a record from database before you can update it.

Next time, please don’t forget to mention what’s wrong, what errors you get etc.

Both the AX and the internet are full of examples.

Hi;

select forupdate table_needs_to_be _updated

where table_needs_to_be _updated.fieldname == value1

&& table_needs_to_be _updated.fieldname == value2

if (table_needs_to_be _updated)

{

ttsbegin;

table_needs_to_be _updated.fieldname = somevalue;

table_needs_to_be _updated.doupdate();

ttscommit;

}

please try this solution and reply if it works.