Hi,

problem ist that you are not using the query of the form.
If your code is in the init() of the form Datasource:
q = this.Query();

How to: Access the Active Query on Forms

Best regards
Michael



From: girac127 
Sent: Tuesday, September 01, 2009 5:11 PM
To: Axapta-Knowledge-Village@yahoogroups.com 
Subject: [Axapta-Knowledge-Village] Re: Displaying Records On Form From Query


  Hello all, 

Here is my code, Maybe I not place it right location. What I want to do is open 
the form and display only records matching the criteria of "Open order".
I am learning developing in X++ so thank you all for bearing with me on this.

public void init()
{
Query q = new Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;

;

super();
qbds = q.addDataSource(tableNum(PurchTable));

//qbds.addRange( fieldNum( PurchTable, PurchStatus) 
).value(enum2str(purchstatus::Backorder));

qbds.addRange( fieldNum( PurchTable, PurchStatus) 
).value(queryvalue(purchstatus: :BackOrder) );

//qbds.addRange(fieldNum(PurchTable, PurchStatus)).value(enum2str (Purchstatus: 
:1) );
// qbds.addRange(fieldNum(PurchTable,PurchStatus)).value('Open order');
//qbds.addRange(fieldNum(PurchTable,PurchStatus)).value(enum2str (

info(qbds.toString());

}

--- In Axapta-Knowledge-Village@yahoogroups.com, "sanju_kori" <sanju_k...@...> 
wrote:
>
> Hi girac,
> 
> Try this statement:
> qbds.addRange( fieldNum( PurchTable, PurchStatus) 
> ).value(queryvalue(purchstatus: :BackOrder) );
> 
> if not then please post bout d solution u came out wid.........
> 
> regards,
> Sanjiv
> 
> --- In Axapta-Knowledge-Village@yahoogroups.com, Anitha S <mail2eanitha@> 
> wrote:
> >
> > girac,
> > Can u send in ur code.. then we can check wats wrong with it...
> > Regards,
> > Anitha
> > On Tue, Aug 25, 2009 at 8:25 PM, giarc 127 <girac127@> wrote:
> > 
> > >
> > >
> > >
> > > Hello all,
> > > When I use the suggested code I get an error saying my variable 
> > > Purchstatus
> > > is not declared, I declared this, but getting an error.
> > > How does this need to be declared?
> > >
> > > regards,
> > > ------------------------------
> > > *From:* sreenath reddy <shysrinath@>
> > > *To:* Axapta-Knowledge-Village@yahoogroups.com
> > > *Sent:* Tuesday, August 25, 2009 5:39:59 AM
> > > *Subject:* Re: [Axapta-Knowledge-Village] Displaying Records On Form From
> > > Query
> > >
> > >
> > >
> > >
> > > Hi,
> > >
> > > try using
> > >
> > > qbds.addRange( fieldNum( PurchTable, PurchStatus) ).value(enum2str
> > > (purchstatus: :BackOrder) );
> > >
> > > regards,
> > > sreenath
> > >
> > >
> > > --- On *Tue, 8/25/09, girac127 <girac...@yahoo. com>* wrote:
> > >
> > >
> > > From: girac127 <girac...@yahoo. com>
> > > Subject: [Axapta-Knowledge- Village] Displaying Records On Form From Query
> > > To: Axapta-Knowledge- vill...@yahoogro ups.com
> > > Date: Tuesday, August 25, 2009, 12:07 AM
> > >
> > >
> > >
> > > Good day all.
> > >
> > > My requirement is to display only records where the PurchStatus =1 on
> > > a new PO detail form which I have in place.
> > >
> > > I have the following code in the init Datasource(Purchtab le) Method. What
> > > am I missing to have this execute?
> > >
> > > public void init()
> > > {
> > > Query q = new Query();
> > > QueryBuildDataSourc e qbds;
> > >
> > > ;
> > > super();
> > > qbds = q.addDataSource( tableNum( PurchTable) );
> > > qbds.addRange( fieldNum( PurchTable, PurchStatus) ).value("1");
> > >
> > > info(qbDS.toString( ));
> > >
> > > }
> > >
> > > I have the info displaying my correct query, but I am returning
> > > results other than the value of "1"
> > >
> > >
> > >
> > > 
> > >
> >
>



Reply via email to