Hello Andrew and Thomas,



Andrew thank you for the link.  After reading it, I had an idea of how to get around the problem.


Thomas, here is a working example of how to get around it.


public void lookup()
{
    EmplTable                   EmplTable;
    SysTableLookup              SysTableLookup          = SysTableLookup::newParameters(TableNum(EmplTable), this);
    Query                       Query                   = new Query();
    QueryBuildDataSource        lqbds;
    QueryBuildRange             qbr;
    ;

    lqbds           = Query.addDataSource(TableNum(EmplTable));
    qbr             = lqbds.addRange(FieldNum(EmplTable, Name));
    qbr.value(strfmt('(((EmplID >= "%1") && (EmplID <= "%1Z")) || ((Name >= "%1") && (Name <= "%1Z"))))', this.text()));

    SysTableLookup.addLookupfield(FieldNum(EmplTable, EmplID), true);
    SysTableLookup.addLookupfield(FieldNum(EmplTable, Name));
    SysTableLookup.addLookupfield(FieldNum(EmplTable, Alias));

    SysTableLookup.parmQuery(Query);
    SysTableLookup.performFormLookup();
}

While not ideal, what you can do is set a range containing the values.

For example, if the user enters "ba", then I use the range "ba" .. "baZ".



Barry.



-----Original Message-----
From: development-axapta@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Askeryd Thomas
Sent: Wednesday, 7 December 2005 5:40 PM
To: development-axapta@yahoogroups.com
Subject: SV: SV: [development-axapta] Query to 'OR' two ranges

There ought to be a way around though. If no other way is possible you could always send the SQL-query directly to the database through a connection. I have not done it myself but seen others which have. Standard SQL queries allows for much more complex searches than is possible in Axapta. I hope they will fix that soon.

Thomas.



________________________________

Från: development-axapta@yahoogroups.com [mailto:[EMAIL PROTECTED] För ozzage
Skickat: den 6 december 2005 18:39
Till: development-axapta@yahoogroups.com
Ämne: Re: SV: [development-axapta] Query to 'OR' two ranges



Hi Barry

Unfortunately it's not possible to use wildcards when using the
extended range syntax.

See this page for more details on this concept:

http://www.axaptapedia.com/index.php/Expressions_in_query_ranges

Regards

Andrew Jones

--- In development-axapta@yahoogroups.com, "Bayliss, Barry"
<[EMAIL PROTECTED]> wrote:
>
>
>
> While the following works for fixed values, has anyone managed to
make this work with wildcards????  (Each time I've tried, I received
an error 'Query extended range failure: Right parenthesis
expected ...')
>
>
> Barry.
>
> -----Original Message-----
> From: development-axapta@yahoogroups.com [mailto:development-
[EMAIL PROTECTED] On Behalf Of Andrew Zekveld
> Sent: Tuesday, 6 December 2005 12:15 AM
> To: development-axapta@yahoogroups.com
> Subject: Re: SV: [development-axapta] Query to 'OR' two ranges
>
> Thanks! I got it to work.
>
> for those who will be trying the solution below:
>
> I couldn't get it to work with 'Person.Age' as is used in the
> example below. Leave out the table name if you are only working in
> one table, then it works. Otherwise you get a error message
> indicating that the datasource.field is incorrect. The way I got it
> to work is as follows
>
> queryBuildDataSource = query.addDataSource(tableNum(Table1));
> queryBuildRange      = queryBuildDataSource.addRange(fieldNum
> (Table1, Field1));
> tmpStr = strFmt('((Field1 == noyes::Yes) || (Field2 ==
> noyes::Yes))'); // noyes::Yes is an enum value in my case
> queryBuildRange.value(tmpStr);
>
> Thanks Thomas!
>
> --- In development-axapta@yahoogroups.com, "Askeryd Thomas"
> <[EMAIL PROTECTED]> wrote:
> >
> > What I got in the reply worked just fine.. except from the
> >     qbdsStat.relations(true);
> >     qbdsStat.joinMode(JoinMode::ExistsJoin);
> > 
> > which never seems to work for me. I have to use
> >     qbdsStat.addLink(FieldNum(Persons, Pnr),FieldNum(FamStatus,
> Pnr));
> > 
> > has anybody got a clue what that is all about...
> > anyhow.. with that in mind this works just fine
> >     qbrStat.value(strFmt('(((Salary > 3000) && (Persons.Age <20))
> ||
> >                                       ((Salary < 400) &&
> (Persons.Age > 50)))'));
> > 
> > for ex to show that it really works. If you still cant get it to
> work just give us a shout and I ll send you an xpo.
> > Thomas.
> >
> > ________________________________
> >
> > Från: development-axapta@yahoogroups.com genom zekvelda
> > Skickat: fr 2005-12-02 09:05
> > Till: development-axapta@yahoogroups.com
> > Ämne: [development-axapta] Query to 'OR' two ranges
> >
> >
> > Hi
> >
> > I have a request very similiar to post number 12021
> concerning 'OR'ing
> > two different fields on a table in a query. I've tried the
> solution
> > proposed in post 12021 with no success.
> >
> > My scenariois as follows:
> >
> > I have a query on a table (MyTable). I want to return all the
> records
> > where 'Field1 == noyes::Yes' OR 'Field2 == noyes:Yes'. 'Field1'
> > and 'Field2' are two DIFFERENT field in 'MyTable'.
> >
> > As was mentioned in the posts preceding post 12021, the default
> method
> > of creating two query ranges is an AND and I want an OR.
> >
> > Has anyone successfully implmented an 'OR' for a BuildQueryRange?
> If
> > so, can you please share your method?
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Computer part <http://groups.yahoo.com/gads?
>
t=ms&k=Computer+part&w1=Computer+part&w2=Programming+languages&w3=Mic
>
rosoft+axapta&w4=Support+exchange&c=4&s=90&.sig=yLpvcLTIDJ5FTkRJGsO11
> w>        Programming languages <http://groups.yahoo.com/gads?
>
t=ms&k=Programming+languages&w1=Computer+part&w2=Programming+language
>
s&w3=Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=cuhEClK4dU4wa
> pXFmKisbQ>        Microsoft axapta <http://groups.yahoo.com/gads?
>
t=ms&k=Microsoft+axapta&w1=Computer+part&w2=Programming+languages&w3=
>
Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=yfeG_U6QaLfPOZZIud
> 02Fg>       
> > Support exchange <http://groups.yahoo.com/gads?
>
t=ms&k=Support+exchange&w1=Computer+part&w2=Programming+languages&w3=
>
Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=hy8yRGMzrmxdphyITT
> UeqA>       
> >
> > ________________________________
> >
> > YAHOO! GROUPS LINKS
> >
> >
> >      
> > *      Visit your group "development-axapta
> <http://groups.yahoo.com/group/development-axapta> " on the web.
> >        
> > *      To unsubscribe from this group, send an email to:
> >       [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]
> subject=Unsubscribe>
> >        
> > *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> .
> >
> >
> > ________________________________
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
>
>
>
>
>
>

> Yahoo! Groups Links
>










SPONSORED LINKS

Computer part <http://groups.yahoo.com/gads?t=ms&k=Computer+part&w1=Computer+part&w2=Programming+languages&w3=Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=yLpvcLTIDJ5FTkRJGsO11w

Programming languages <http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Computer+part&w2=Programming+languages&w3=Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=cuhEClK4dU4wapXFmKisbQ

Microsoft axapta <http://groups.yahoo.com/gads?t=ms&k=Microsoft+axapta&w1=Computer+part&w2=Programming+languages&w3=Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=yfeG_U6QaLfPOZZIud02Fg

Support exchange <http://groups.yahoo.com/gads?t=ms&k=Support+exchange&w1=Computer+part&w2=Programming+languages&w3=Microsoft+axapta&w4=Support+exchange&c=4&s=90&.sig=hy8yRGMzrmxdphyITTUeqA







________________________________

YAHOO! GROUPS LINKS



*      Visit your group "development-axapta <http://groups.yahoo.com/group/development-axapta> " on the web.
       
*      To unsubscribe from this group, send an email to:
      [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
       
*      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> .



________________________________



[Non-text portions of this message have been removed]







Yahoo! Groups Links










SPONSORED LINKS
Computer part Programming languages Microsoft axapta
Support exchange


YAHOO! GROUPS LINKS




Reply via email to