Hi Barry,

The reason is simply I want to follow the common way to change form data
source query, which is passing new query object to the data source. If it
could, then we can do it in a loop and further can be used later for larger
field array,which is a good programming practice I think.

But it seems can't be done right now, as Andrew Jones said.
I will use select statement instead.

Thanks  Barry and Andrew for your comment.


Regards,

Agus

On 2/9/06, Bayliss, Barry <[EMAIL PROTECTED]> wrote:
>
> Agus,
>
> Is there a reason why you are trying to do this using the Query
> structure?  Why not use
>
> While
> Select  ProdTable
> Where   (ProdTable.dimension[1] == 'Admin' || ProdTable.dimension[2] ==
> 'fina')
> {
>        .....
> }
>
>
> Barry.
>
>
> -----Original Message-----
> From: development-axapta@yahoogroups.com
> [mailto:[EMAIL PROTECTED] On Behalf Of ozzage
> Sent: Tuesday, 7 February 2006 6:47 PM
> To: development-axapta@yahoogroups.com
> Subject: [development-axapta] Re: query with or array field
>
> Hi Agus
>
> I have never seen a solution to your problem.  As far as I know, it's
> simply not possible to reference array fields when utilising the
> extended query syntax.
>
> I live in hope that somebody will correct me :)
>
> Regards
>
> Andrew Jones
>
> --- In development-axapta@yahoogroups.com, Agus Riyadi <[EMAIL PROTECTED]>
> wrote:
> >
> > Hi Solary,
> >
> > I sill haven't solved the problem.
> > Thanks for your reply, but that won't work since the first and third
> > parameter for strfmt will be blank because it is supplied with blank
> value
> > rather than column name. When I change it to colum name -which the
> same as
> > the first job I posted- it raises query extended failure.
> >
> > Regards,
> >
> > Agus
> >
> >
> > On 2/6/06, solary_luo <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi,
> > >
> > > Have you resolved?  If not, you can try it.
> > >
> > > Replace the strRange sentence like below:
> > >
> > > strRange = strfmt('(%1 == "%2") || (%3 == "%4")',prodtable.dimension
> > > [1],'admin',prodtable.dimension[2],'fina');
> > >
> > > Regards,
> > >
> > >
> > >
> > >
> > > --- In development-axapta@yahoogroups.com, "Agus Riyadi"
> > > <agusacil@> wrote:
> > > >
> > > > Dear All,
> > > >
> > > > There have been a lot of discussion about query with or, but I
> > > don't
> > > > find one that address to array field.
> > > >
> > > > I have a query like this, which I need to change it to a query
> > > > object :
> > > >
> > > > select prodtable where prodtable.dimension[1] == 'admin'
> > > >         || prodtable.dimension[2] == 'fina';
> > > >
> > > > I tried this job to buid a query object :
> > > >
> > > > static void job11(Args _args)
> > > > {
> > > >
> > > >     ProdTable                   ProdTable;
> > > >     QueryBuildDataSource        ds;
> > > >     Query                       q;
> > > >     QueryRun                    qr;
> > > >     QueryBuildRange             range;
> > > >     Str                         strRange;
> > > >     ;
> > > >
> > > >     q = new Query();
> > > >     ds = q.addDataSource(tablenum(ProdTable));
> > > >     range = ds.addRange(fieldnum(ProdTable,Dimension));
> > > >
> > > >     strRange = strfmt('(%1 == "%2") || (%3 == "%4")',
> > > >         'dimension[1]','admin',
> > > >         'dimension[2]','fina');
> > > >
> > > >     range.value(strRange);
> > > >
> > > >     qr = new QueryRun(q);
> > > >
> > > >     while(qr.next())
> > > >     {
> > > >         PRODTABLE = qr.getNo(1);
> > > >         info(prodTable.ProdId);
> > > >     }
> > > >
> > > > }
> > > >
> > > > But an error raised :
> > > >
> > > > Query extended range failure: Right parenthesis expected near pos
> > > 0.
> > > >
> > > >
> > > > Can anyone give a clue to correct that code, or there any
> > > > alternatives ?
> > > > Thanks for any comments.
> > > >
> > > >
> > > > Regards,
> > > >
> > > > Agus
> > > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Yahoo! Groups Links
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


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





SPONSORED LINKS
Computer part Programming languages Microsoft axapta
Support exchange


YAHOO! GROUPS LINKS




Reply via email to