if(this.validateTable1(table1)) { //logic } private boolean validateTable1(Table1 _table1) { if (!_table1) { throw Error("@AAA:NotFound"); } if (_table1.Fieldx != Enum::A) { throw Error(strFmt("@AAA:NotA", _table1.Id)); } return true; }
this.validateTabl1(table1)) //logic private void validateTable1(Table1 _table1) { if (!_table1) { throw Error("@AAA:NotFound"); } if (_table1.Fieldx != Enum::A) { throw Error(strFmt("@AAA:NotA", _table1.Id)); } }
private boolean validateTable1(Table1 _table1) { if (!_table1) { ok=true; } if (_table1.Fieldx != Enum::A) { ok=true; } return ok; }
Best regards.
private boolean validateTable1(Table1 _table1) { boolean ok = true; if (!_table1) { ok = checkFailed("@AAA:NotFound"); } if (ok && _table1.Fieldx != Enum::A) { ok = checkFailed(strFmt("@ANNE:NotA", _table1.Id)); } return ok; }
private Table1 updateTable1(Table1Contract _table1Contract) { Table1 table1; ttsbegin; select forupdate firstonly Id from table1 where table1.Id == _table1Contract.parmId(); if(this.validate(table1)) { // logic to update certain fields table1.update(); } else { throw Exception::Error; // where they will be a catch that will gather all error messages from the infolog } ttscommit; return table1; } private boolean validate(Table1 _table1) { boolean ret = true; if (!_table1) { ret = checkFailed("@AAA:NotFound"); } if (ret) { if(_table1.Fieldx != Enum::A) { ret = checkFailed(strFmt("@AAA:NotA", _table1.Id)); } if(_table1.Fieldy != Enum::C) { ret = checkFailed(strFmt("@AAA:NotC", _table1.Id)); } } return ret; }
private Table1 updateTable1(Table1Contract _table1Contract) { Table1 table1; ttsbegin; select forupdate firstonly Id from table1 where table1.Id == _table1Contract.parmId(); if(!table1) { throw error("@AAA:NotFound"); } if(this.validate(table1)) { // logic to update certain fields table1.update(); } else { throw Exception::Error; // where they will be a catch that will gather all error messages from the infolog } ttscommit; return table1; } private boolean validate(Table1 _table1) { boolean ret = true; if(_table1.Fieldx != Enum::A) { ret = checkFailed(strFmt("@AAA:NotA", _table1.Id)); } if(_table1.Fieldy != Enum::C) { ret = checkFailed(strFmt("@AAA:NotC", _table1.Id)); } return ret; }
​ if(table1.validateWrite()) { // logic to update certain fields table1.update(); } ​
​ if(this.validate() && table1.validateWrite()) { // logic to update certain fields table1.update(); } ​
select forupdate firstonly Id from table1 where table1.Id == _table1Contract.parmId(); if(!table1) { throw error("@AAA:NotFound"); }this.updateTable1(table1);
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
CA Neeraj Kumar 2,004
André Arnaud de Cal... 865 Super User 2025 Season 2
Sohaib Cheema 582 User Group Leader