oh, misunderstood your doubt.. sorry... just  noticed  !
  ----- Original Message ----- 
  From: André Santos 
  To: Axapta-Knowledge-Village@yahoogroups.com 
  Sent: Thursday, January 15, 2009 6:03 PM
  Subject: Re: [Axapta-Knowledge-Village] Re: record count



  Both way works

  It's a little weird, but if you do this :

  static void AnyThing(Args args[])
  {
      select count(recId) from myTable;
      info(strfmt("%1",myTable.recId)); 
  }

  the field recId will hold the count. but I still prefer to use the CountTotal 
as Hentz said


    ----- Original Message ----- 
    From: Rodrigo Hentz 
    To: Axapta-Knowledge-Village@yahoogroups.com 
    Sent: Thursday, January 15, 2009 4:57 PM
    Subject: RE: [Axapta-Knowledge-Village] Re: record count



    Use SysQuery::countTotal


    Example:

                    


            query = new Query();

            queryBuildDataSource = query.addDataSource(tableNum(EmplTable));

            queryRun = new QueryRun(query);


            info(int2str(SysQuery::countTotal(queryRun));







    From: Axapta-Knowledge-Village@yahoogroups.com 
[mailto:axapta-knowledge-vill...@yahoogroups.com] On Behalf Of mane.shankar10
    Sent: quinta-feira, 15 de janeiro de 2009 02:54
    To: Axapta-Knowledge-Village@yahoogroups.com
    Subject: [Axapta-Knowledge-Village] Re: record count


    --- In Axapta-Knowledge-Village@yahoogroups.com, "dgreatone123"
    <dgreatone...@...> wrote:
    >
    > Hi,
    > 
    > sELECT count(recid) FROM EmplTable;
    > 
    > I want to execute the above statement
    > 
    > but the table will be variable, I will 
    > supply the table name. How can It be done?
    > 
    > something like this.
    > 
    > selec count(recid) from tname;
    > 
    > where tname='EmplTable";
    > 
    > Any help will be greatly appreciated.
    > 
    > regards,

    hI
    > D' great
    USE THE EDT TABLENAME FOR HAVING ALL TABLENAME LOOKUP
    THEN USE A VARIABLE TO STORE SELECTED TABLE NAME

    THEN DO AS FOLLOWS

    common common;;
    DICTTABLE DT;
    ;
    dt=new dicttable(tablename2id(SELECTEDTABLENAME STORED IN VARIABLE));
    common=dt.makeRecord();
    sELECT count(recid) FROM COMMON;

    AND IT WILL WORK 100%

    REGARDS;




   

Reply via email to