Performance impact wrt place of code in active method of ds

can anyone please tell me, which wil be the best irrespective of performance.

  1. //active method of Purch table ds in PurchTable form

if (purchTable.Status == PurchReqStatus::Approved)

{

PurchLine_PurchPrice.allowEdit(false);

}

else

{

PurchLine_PurchPrice.allowEdit(true);

}

2)1) //active method of Purch Line ds in PurchTable form

if (PurchLine.purchTable().Status == PurchReqStatus::Approved)

{

PurchLine_PurchPrice.allowEdit(false);

}

else

{

PurchLine_PurchPrice.allowEdit(true);

}

Of course that not calling purchLine,purchTable() is faster than calling it. :slight_smile: There would be a call to database at the first time and lookups to cache in subsequent calls (which is still more expensive than doing nothing).

Thanks Martin for your reply.

I thought in case of more lines

in case 1)one call to the database

2)multiple no.of calls to the database

so i think case1 will provide better performance than case2…

Please suggest me whether i’m right or wrong.

There is no database call in 1), it merely read from a buffer in memory and call a method of a form control. The other case has one DB call, in purchTable().

what i mean…

if there 10 lines in one purchase order.

if i’m moving cursor from record to record i.e from line1…line10

in case2) active() being called every time(10 times)

  1. active() being called one time only

so i kindly requesting you to confirm is there any difference wrt performance in case1,case2

or

both are same

If you activate ten lines one by one, active() of the line data source will be called ten times. It has nothing to do with your code.

Martin sir,

still u r not clarifying my query…

considering performance both cases are same or not…

if not which one is reliable.

I’ve already explained it in my very first reply. The second case is slower because it contain a call to database / cache.

Thanks for your valuable time and guidance.