[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.axapta.programming

Count records in busrel form different from contactperson?

BaSt

12/5/2005 12:40:00 PM

I'm very interested in the number of records displayed in the form.
Therefore i've build a field countrecords that goes to the method:

display int recordsCnt()
{
queryRun qr = new QueryRun(SMMBusRelTable_ds.queryRun().query());
return SysQuery::countTotal(qr);
}

Which works great on the SMMBusRelTable. and really quick too.

When i try the same on the smmcontactperson form things are different:
Same display int
display int contactrecordCnt()
{
queryRun qr = new QueryRun(ContactPersonTable_ds.queryRun().query());
return SysQuery::countTotal(qr);
}

But now the form hangs... just keeps on counting so it seems...
Any suggestions?

7 Answers

BaSt

12/5/2005 1:08:00 PM

0

as a matter of fact... it just keeeeeeeeps on counting till 1.189.727.750
and there are only about 60.000 contactpersons...

a wrong kind of loop?

"BaSt" wrote:

> I'm very interested in the number of records displayed in the form.
> Therefore i've build a field countrecords that goes to the method:
>
> display int recordsCnt()
> {
> queryRun qr = new QueryRun(SMMBusRelTable_ds.queryRun().query());
> return SysQuery::countTotal(qr);
> }
>
> Which works great on the SMMBusRelTable. and really quick too.
>
> When i try the same on the smmcontactperson form things are different:
> Same display int
> display int contactrecordCnt()
> {
> queryRun qr = new QueryRun(ContactPersonTable_ds.queryRun().query());
> return SysQuery::countTotal(qr);
> }
>
> But now the form hangs... just keeps on counting so it seems...
> Any suggestions?
>

vladimir40

12/5/2005 8:54:00 PM

0

Hi,
Try to use the right name for datasource ContactPerson_ds



"BaSt" wrote:

> as a matter of fact... it just keeeeeeeeps on counting till 1.189.727.750
> and there are only about 60.000 contactpersons...
>
> a wrong kind of loop?
>
> "BaSt" wrote:
>
> > I'm very interested in the number of records displayed in the form.
> > Therefore i've build a field countrecords that goes to the method:
> >
> > display int recordsCnt()
> > {
> > queryRun qr = new QueryRun(SMMBusRelTable_ds.queryRun().query());
> > return SysQuery::countTotal(qr);
> > }
> >
> > Which works great on the SMMBusRelTable. and really quick too.
> >
> > When i try the same on the smmcontactperson form things are different:
> > Same display int
> > display int contactrecordCnt()
> > {
> > queryRun qr = new QueryRun(ContactPersonTable_ds.queryRun().query());
> > return SysQuery::countTotal(qr);
> > }
> >
> > But now the form hangs... just keeps on counting so it seems...
> > Any suggestions?
> >

BaSt

12/6/2005 8:01:00 AM

0

i see... but that was just an error in the typing i did here, not in the
method.
(i just copy/pasted the first method and changed it in the post)

"vladimir40" wrote:

> Hi,
> Try to use the right name for datasource ContactPerson_ds
>
>
>
> "BaSt" wrote:
>
> > as a matter of fact... it just keeeeeeeeps on counting till 1.189.727.750
> > and there are only about 60.000 contactpersons...
> >
> > a wrong kind of loop?
> >
> > "BaSt" wrote:
> >
> > > I'm very interested in the number of records displayed in the form.
> > > Therefore i've build a field countrecords that goes to the method:
> > >
> > > display int recordsCnt()
> > > {
> > > queryRun qr = new QueryRun(SMMBusRelTable_ds.queryRun().query());
> > > return SysQuery::countTotal(qr);
> > > }
> > >
> > > Which works great on the SMMBusRelTable. and really quick too.
> > >
> > > When i try the same on the smmcontactperson form things are different:
> > > Same display int
> > > display int contactrecordCnt()
> > > {
> > > queryRun qr = new QueryRun(ContactPersonTable_ds.queryRun().query());
> > > return SysQuery::countTotal(qr);
> > > }
> > >
> > > But now the form hangs... just keeps on counting so it seems...
> > > Any suggestions?
> > >

Player

12/6/2005 9:39:00 AM

0

Hi,

Try to set the joinType of the Table ContactPerson to Innerjoin on the
form...

Kind regards,

Philippe Vanstipelen

BaSt

12/6/2005 1:49:00 PM

0

That didnt do the trick:

Error Message (14:45:20) Error executing code: <empty class> object not
initialized.

Stack trace:
(C) \Classes\<unknown>\dataSourceNo
(C) \Forms\CopyOfsmmContactPerson\Data Sources\ContactPerson\Methods\init

Error Message (14:45:20) Error executing code: QueryBuildRange object not
initialized.

Stack trace:
(C) \Classes\QueryBuildRange\value
(C) \Forms\CopyOfsmmContactPerson\Data
Sources\ContactPerson\Methods\executeQuery

Error Message (14:45:20) Error executing code: <empty class> object not
initialized.

Stack trace:
(C) \Classes\<unknown>\query
(C) \Forms\CopyOfsmmContactPerson\Methods\countrecordscont

Error Message (14:45:20) Error executing code: <empty class> object not
initialized.

Stack trace:
(C) \Classes\<unknown>\query
(C) \Forms\CopyOfsmmContactPerson\Methods\countrecordscont

Error Message (14:45:20) Error executing code: <empty class> object not
initialized.

Stack trace:
(C) \Classes\<unknown>\query
(C) \Forms\CopyOfsmmContactPerson\Methods\countrecordscont
(C) \Classes\FormDataSource\refresh
(C) \Classes\FormStringControl\enter
(C) \Classes\FormRun\selectControl
(C) \Classes\FormStringControl\setFocus
(C) \Forms\CopyOfsmmContactPerson\Methods\firstField
(C) \Classes\FormRun\activate

Error Message (14:45:20) Error executing code: <empty class> object not
initialized.

Stack trace:
(C) \Classes\<unknown>\query
(C) \Forms\CopyOfsmmContactPerson\Methods\countrecordscont
(C) \Classes\FormDataSource\refresh
(C) \Classes\FormStringControl\enter
(C) \Classes\FormRun\selectControl



"Player" wrote:

> Hi,
>
> Try to set the joinType of the Table ContactPerson to Innerjoin on the
> form...
>
> Kind regards,
>
> Philippe Vanstipelen
>

mortenm

12/8/2005 8:09:00 AM

0

Hei BaSt,

I once read that if a query has one datasource you should use
SysQuery::countTotal(qr)

If the query has more than one datasource you should use
SysQuery::countLoops(qr).

Your code could look like this:
if (query.dataSourceCount() == 1)
{
maxLin = SysQuery::countTotal(queryRun);
}
else
{
maxLin = SysQuery::countLoops(queryRun);
}

Regards,
Morten Mile

"BaSt" wrote:

> I'm very interested in the number of records displayed in the form.
> Therefore i've build a field countrecords that goes to the method:
>
> display int recordsCnt()
> {
> queryRun qr = new QueryRun(SMMBusRelTable_ds.queryRun().query());
> return SysQuery::countTotal(qr);
> }
>
> Which works great on the SMMBusRelTable. and really quick too.
>
> When i try the same on the smmcontactperson form things are different:
> Same display int
> display int contactrecordCnt()
> {
> queryRun qr = new QueryRun(ContactPersonTable_ds.queryRun().query());
> return SysQuery::countTotal(qr);
> }
>
> But now the form hangs... just keeps on counting so it seems...
> Any suggestions?
>

BaSt

12/12/2005 8:37:00 AM

0

Thanks... works like a charm...

but...

now the problem arises when you create a query on a form and use an extra
datasource

But i'm close now :)

"mortenm" wrote:

> Hei BaSt,
>
> I once read that if a query has one datasource you should use
> SysQuery::countTotal(qr)
>
> If the query has more than one datasource you should use
> SysQuery::countLoops(qr).
>
> Your code could look like this:
> if (query.dataSourceCount() == 1)
> {
> maxLin = SysQuery::countTotal(queryRun);
> }
> else
> {
> maxLin = SysQuery::countLoops(queryRun);
> }
>
> Regards,
> Morten Mile
>
> "BaSt" wrote:
>
> > I'm very interested in the number of records displayed in the form.
> > Therefore i've build a field countrecords that goes to the method:
> >
> > display int recordsCnt()
> > {
> > queryRun qr = new QueryRun(SMMBusRelTable_ds.queryRun().query());
> > return SysQuery::countTotal(qr);
> > }
> >
> > Which works great on the SMMBusRelTable. and really quick too.
> >
> > When i try the same on the smmcontactperson form things are different:
> > Same display int
> > display int contactrecordCnt()
> > {
> > queryRun qr = new QueryRun(ContactPersonTable_ds.queryRun().query());
> > return SysQuery::countTotal(qr);
> > }
> >
> > But now the form hangs... just keeps on counting so it seems...
> > Any suggestions?
> >