ok.
I guess u r writing the code in *Datasource* lookup. My code was for
formcontrol lookup. That is y u are getting the error.
check if the following code works for u.

The range for this query is field1.
Based on the value of field1, data in field2 will be filtered as lookup.
public void lookup(FormControl _formControl, str _filterStr)
{

    Query q = new query();
    QueryBuilddatasource qbds;
    QueryBuildRange       qbr1;
    Systablelookup          _systablelookup;

    Table1  objTable1;
    ;
    super(_formControl, _filterStr);

    _systablelookup =
Systablelookup::newParameters(tablenum(HexPayelementvalueConfig),_*
formControl*);

    qbds  = q.addDataSource(tablenum(Table1));
    qbr1  = qbds.addRange(fieldnum(Table1,field1));
    qbr1.value(QueryValue(Table1.field1));

    _systablelookup.parmTmpBuffer(objTable1);
    _systablelookup.addLookupfield(fieldnum(Table1,field2),true);
    _systablelookup.parmQuery(q);
    _systablelookup.performFormLookup();

}

Regards,
Anitha



On Fri, Aug 7, 2009 at 12:51 AM, Girac <girac...@yahoo.com> wrote:

>
>
> Maybe I am not explaining correctly,
> I have a form that displays a grid of work orders. On grid there is
> filter for responsible person and department. Both of these are
> fields on my grid. I would also like to add a new filter called order
> id, which is also a field on grid, in same table as responsible
> person and department.
>
> I have copied the methods for these tables but cannot get the filter
> to work. The query is pulling all order ID correctly but when I
> select a record in the filter query I do not go to that record.
> I put the methods under my form filter control, as overrides. This is
> how other were set.
>
> When I add your code to the datasource I get the following error:
> "Argument 'callingControl' is incompatible with the required type."
> This in happening on line 3.
>
> I have worked within Ax for 3 years but new to the development side,
>
> thank you for bearing with me.
>
> --- In 
> Axapta-Knowledge-Village@yahoogroups.com<Axapta-Knowledge-Village%40yahoogroups.com>,
> Anitha S <mail2eani...@...> wrote:
> >
> > Hi..
> > Could you reframe ur qtn.. I could help you out if i m clear with the
> > scenario...
> >
> > U can override the lookup method @ datasource level and design level as
> > well..
> > The code which I ve sent u is to be called @ datasource level.
> >
> > So give me a clear picture and we shall try again..
> >
> > Regards,
> > Anitha
> >
> > On Wed, Aug 5, 2009 at 10:12 PM, Girac <girac...@...> wrote:
> >
> > >
> > >
> > > I am not sure where to put the method. Is this a override, would this
> > > go under the datasource, or under my filter from control and is
> > > there more code that need to be modified?
> > >
> > > Regards,
> > >
> > > G
> > >
> > >
> > > --- In 
> > > Axapta-Knowledge-Village@yahoogroups.com<Axapta-Knowledge-Village%40yahoogroups.com>
> <Axapta-Knowledge-Village%40yahoogroups.com>,
> > > "Girac" <girac127@> wrote:
> > > >
> > > > I have tried your suggestion and no luck. It is acting as if the
> query is
> > > not getting executed.
> > > > any other suggestions?
> > > >
> > > >
> > > > regards, G
> > > >
>  > > > --- In 
> Axapta-Knowledge-Village@yahoogroups.com<Axapta-Knowledge-Village%40yahoogroups.com>
> <Axapta-Knowledge-Village%40yahoogroups.com>,
> > > Anitha S <mail2eanitha@> wrote:
> > > > >
> > > > > hi..
> > > > > Try to pass a valid value in QueryValue and check if the commented
> code
> > > is
> > > > > working.
> > > > >
> > > > >
> > > > > On Tue, Aug 4, 2009 at 8:03 PM, Girac <girac127@> wrote:
> > > > >
> > > > > >
> > > > > >
> > > > > > Below is the code I'm using, the table does get queried and
> results
> > > are
> > > > > > returned as expected. However, when one is selected the record is
> > > > > > not returned. Do I need another method for that?
> > > > > >
> > > > > > I have looked at the SysTableLookup class on MSDN and Axaptapedia
> and
> > > all
> > > > > > looks correct. What did I miss?
> > > > > >
> > > > > > Regards.
> > > > > > G
> > > > > >
> > > > > > public void lookup()
> > > > > > {
> > > > > > SysTableLookup sysTableLookup =
> > > > > > SysTableLookup::newParameters(TableNum(OrderTable), this);
> > > > > > query query = new Query();
> > > > > > QueryBuildDataSource qbds;
> > > > > > QueryBuildRange queryBuildRange;
> > > > > > ;
> > > > > >
> > > > > > sysTableLookup. addLookupfield( fieldnum( OrderTable, OrderID));
> > > > > > sysTableLookup. addLookupfield( fieldnum( OrderTable, Name));
> > > > > >
> > > > > > qbds = query.addDataSource (tablenum( OrderTable));
> > > > > >
> > > > > > qbds.addRange(fieldnum(OrderTable, OrderID));
> > > > > > //qbds.addRange(fieldnum(OrderTable,
> OrderID)).value(QueryValue(1));
> > > > > > //***When above uncommented no results are showing
> > > > > >
> > > > > > sysTableLookup. parmQuery( query);
> > > > > > sysTableLookup. performFormLookup();
> > > > > > }
> > > > > >
> > > > > > --- In 
> > > > > > Axapta-Knowledge-Village@yahoogroups.com<Axapta-Knowledge-Village%40yahoogroups.com>
> <Axapta-Knowledge-Village%40yahoogroups.com>
> > > <Axapta-Knowledge-Village%40yahoogroups.com>,
> > > > > > Anitha S <mail2eanitha@> wrote:
> > > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > Try this code:
> > > > > > >
> > > > > > > public void lookup()
> > > > > > > {
> > > > > > > SysTableLookup sysTableLookup =
> > > > > > > SysTableLookup::newParameters(TableNum,this);
> > > > > > > Query query = new Query() ;
> > > > > > > QueryBuildDataSource qbds;
> > > > > > > Table1 objTable1;
> > > > > > > ;
> > > > > > >
> > > > > > > sysTableLookup.addLookupfield(fieldnum(Table1, Field1));
> > > > > > > sysTableLookup.addLookupfield(fieldnum(Table1, Field2));
> > > > > > >
> > > > > > > qbds = query.addDataSource(tablenum(Table1));
> > > > > > >
> > > > > > > qbds.addRange(fieldnum(Table1, Field1));
> > > > > > > qbds.addRange(fieldnum(Table1, Field2)).value(QueryValue(1));
> > > > > > >
> > > > > > > sysTableLookup.parmQuery(query);
> > > > > > > sysTableLookup.performFormLookup();
> > > > > > > }
> > > > > > >
> > > > > > > Hope this helps.
> > > > > > > Regards,
> > > > > > > Anitha
> > > > > > >
> > > > > > >
> > > > > > > On Tue, Aug 4, 2009 at 2:39 AM, Girac <girac127@> wrote:
> > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Hello all,
> > > > > > > > Can someone help me with building a lookup filter on a form?
> I
> > > want to
> > > > > > > > add a new filter to some forms. I have copied the code from
> > > existing
> > > > > > > > filter to new one. when i compile I get errors variable not
> > > declared,
> > > > > > > > table does not contain this field, etc...
> > > > > > > >
> > > > > > > > I have declared my variable and the error I receive is is
> "table
> > > does
> > > > > > > > not contain this field."
> > > > > > > >
> > > > > > > > Where do I put this table info in my code?
> > > > > > > >
> > > > > > > > If someone can document steps are involved that will be
> great.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> >
>
>  
>

Reply via email to