Reputation: 21
[ExtensionOf(formControlStr(BankReconciliation ,ClearALL))]
final class ClearAll_Extension
{
void clicked(){
next clicked();
FormRun formrunn = this.FormRun();
FormDataObject myField;
FormCheckBoxControl BankAccountTrans_Included = formrunn.design().controlName("BankAccountTrans_Included");
FormDataSource BankAccounttable_ds = formrunn.dataSource("BankAccountTable");
BankAccountTable BankTable = BankAccounttable_ds.cursor();
// BankAccountTable BankTable ;
FormDataSource BankAccountTran = formrunn.dataSource("BankAccountTrans");
myField = BankAccountTran.object(fieldnum(BankAccountTrans,Included));
BankAccountTrans Bankacc ;
/// Bankacc = BankAccountTran.getFirst();
// if(Bankacc.AccountId == BankTable.AccountID)
// {
Bankacc = BankAccountTran.getFirst();
while(Bankacc){
if (Bankacc.Included == NoYes::No)
{
BankAccountTran.object(fieldNum(BankAccountTrans,Included)).setValue(NoYes::Yes) ;
}
else
{
BankAccountTran.object(fieldNum(BankAccountTrans,Included)).setValue(NoYes::No) ;
}
BankAccountTran.write();
Bankacc = BankAccountTran.getNext();
}
I want to select all record by clicking on (clear all) button and run methods of datasource in all record selected . this button select all records but methods of datasource run on only first record doesn't run on all record , cursor still on first record not moving to the next
Upvotes: 0
Views: 1842
Reputation: 1
Why do you need to use datasource methods? If you're doing something on all the records in a table, it makes more sense to do it with a method on the table. Or possibly create a SysOperation and do it in the service class, just loop through all the records. Doing the changes on datasource level makes sense only if you want to change the marked records, in which case you can do it with multiselect.
Upvotes: 0