[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

re: Problem using method findRecord in Go To Maintable

Palle Agermark [MSFT]

10/20/2005 1:52:00 PM

Hi Morten,

findRecord loops sequentially through the records of the form until it finds a match.

The standard routine handled by the kernel runs with two cursors against the database making it very fast.
Unfortunately you can't use this feature from X++/application code.

In stead of using findRecord you could set up query range on the CustTable form you open. With this you'll only see the actual main record, not records before or after.

Best regards,
Palle Agermark
--
This posting is provided "AS IS" with no warranties, and confers no rights.

-----Original Message-----
From: mortenm@discussions.microsoft.com
Posted At: 20. oktober 2005 14:49
Posted To: microsoft.public.axapta.programming
Conversation: Problem using method findRecord in Go To Maintable
Subject: Problem using method findRecord in Go To Maintable


I have made a copy of the form CustTable called MyCustTable. In some forms I
want to start MyCustTable when the user selects Go To Maintable from a
customer account field. The code I use is this:

static void goToMainTable(CustTable custTable)
{
Args args;
FormRun formRun;
;

args = new Args(formstr(MyCustTable));

formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.dataSource().findRecord(custTable);
formRun.detach();
}

The problem is the call to findRecord. With a small dataset everything works
just fine. But with a large dataset the findRecord call migth last for as
long as 10-20 seconds. Of coruse this is a problem for our users.

If we try Go To Maintable in a standard form like SalesTable and the
standard form CustTable is started everything works like it is supposed to.
All customers are shown with focus on the correct customer, and it will only
take a fraction of a second.

What can I do in my goToMainTable to make it work like the standard routine?

Best regards,
Morten
2 Answers

mortenm

10/21/2005 11:17:00 AM

0

Hi Palle,

Thanks for your answer. We modified the query like you suggested to show one
customer. Using the filter buttons in the Go To Maintable form it is possible
to see all the customers.

It''s allways a pleasure to read your answers. You seem to know what you are
talking about, and it often pays off to look into your suggestions .

Best regards,
Morten Mile

"Palle Agermark [MSFT]" wrote:

> Hi Morten,
>
> findRecord loops sequentially through the records of the form until it finds a match.
>
> The standard routine handled by the kernel runs with two cursors against the database making it very fast.
> Unfortunately you can''t use this feature from X++/application code.
>
> In stead of using findRecord you could set up query range on the CustTable form you open. With this you''ll only see the actual main record, not records before or after.
>
> Best regards,
> Palle Agermark
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> -----Original Message-----
> From: mortenm@discussions.microsoft.com
> Posted At: 20. oktober 2005 14:49
> Posted To: microsoft.public.axapta.programming
> Conversation: Problem using method findRecord in Go To Maintable
> Subject: Problem using method findRecord in Go To Maintable
>
>
> I have made a copy of the form CustTable called MyCustTable. In some forms I
> want to start MyCustTable when the user selects Go To Maintable from a
> customer account field. The code I use is this:
>
> static void goToMainTable(CustTable custTable)
> {
> Args args;
> FormRun formRun;
> ;
>
> args = new Args(formstr(MyCustTable));
>
> formRun = ClassFactory.formRunClass(args);
> formRun.init();
> formRun.run();
> formRun.dataSource().findRecord(custTable);
> formRun.detach();
> }
>
> The problem is the call to findRecord. With a small dataset everything works
> just fine. But with a large dataset the findRecord call migth last for as
> long as 10-20 seconds. Of coruse this is a problem for our users.
>
> If we try Go To Maintable in a standard form like SalesTable and the
> standard form CustTable is started everything works like it is supposed to.
> All customers are shown with focus on the correct customer, and it will only
> take a fraction of a second.
>
> What can I do in my goToMainTable to make it work like the standard routine?
>
> Best regards,
> Morten
>

DouglasT

11/7/2005 3:02:00 PM

0

try the following

THIS WILL INSTRUCT THE KERNEL TO USE THE BUILTIN FASTPOS



public void jumpRef()
{
//super();
Args args;
FormRun formRun;
;

args = new Args(formstr(MyCustTable));
//
//this will improve performance
//must be exceuted BEFORE FormRun INIT
//and will instruct axapta kernel to do the fast pos
//
//SORTORDER is influenced by this
//
//hottip: Axapta Guys: this is a potential candidate
// for zipCodeLookup enhancement
//
// if you're able to fix the sorting problem
//
args.lookupField(fieldnum(CustTable,AccountNum));
args.lookupValue(this.text());
//
formRun = ClassFactory.formRunClass(args);
formRun.init();
formRun.run();
//THIS IS THE SLOWEST THING IN THE WORLD IF YOU HAVE
//MORE THAN 42 RECORDS.
//formRun.dataSource().findRecord(custTable);
formRun.detach();

}


regards and cu at towel day 2005 -

DouglasT

"Palle Agermark [MSFT]" <palle.agermark@online.microsoft.com> schrieb im
Newsbeitrag news:%23mvYD2X1FHA.1740@TK2MSFTNGP09.phx.gbl...
> Hi Morten,
>
> findRecord loops sequentially through the records of the form until it
> finds a match.
>
> The standard routine handled by the kernel runs with two cursors against
> the database making it very fast.
> Unfortunately you can't use this feature from X++/application code.
>
> In stead of using findRecord you could set up query range on the CustTable
> form you open. With this you'll only see the actual main record, not
> records before or after.
>
> Best regards,
> Palle Agermark
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
> -----Original Message-----
> From: mortenm@discussions.microsoft.com
> Posted At: 20. oktober 2005 14:49
> Posted To: microsoft.public.axapta.programming
> Conversation: Problem using method findRecord in Go To Maintable
> Subject: Problem using method findRecord in Go To Maintable
>
>
> I have made a copy of the form CustTable called MyCustTable. In some forms
> I
> want to start MyCustTable when the user selects Go To Maintable from a
> customer account field. The code I use is this:
>
> static void goToMainTable(CustTable custTable)
> {
> Args args;
> FormRun formRun;
> ;
>
> args = new Args(formstr(MyCustTable));
>
> formRun = ClassFactory.formRunClass(args);
> formRun.init();
> formRun.run();
> formRun.dataSource().findRecord(custTable);
> formRun.detach();
> }
>
> The problem is the call to findRecord. With a small dataset everything
> works
> just fine. But with a large dataset the findRecord call migth last for as
> long as 10-20 seconds. Of coruse this is a problem for our users.
>
> If we try Go To Maintable in a standard form like SalesTable and the
> standard form CustTable is started everything works like it is supposed
> to.
> All customers are shown with focus on the correct customer, and it will
> only
> take a fraction of a second.
>
> What can I do in my goToMainTable to make it work like the standard
> routine?
>
> Best regards,
> Morten