[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.axapta.programming

Changing the range in a query

Thomaslp

2/7/2006 6:59:00 PM

Hi,

I have created a query from scratch. When I call the qr.promt() method I
cant change the value that I have defined through the qbr.value() method. How
do I enable this?

Also I think that the dialog that appears is pretty lousy. Is there some way
to call the standard query dialog through some super call or??
5 Answers

Thomaslp

2/8/2006 4:23:00 PM

0

Since I got no response I will try to be more specific. I have the following
code:

SalesTable st;
Query q = new Query(QueryStr(Cust));
QueryRun qr;
QueryBuildDataSource ds = q.addDataSource(TableNum(SalesTable));
QueryBuildRange br = ds.addRange(FieldNum(SalesTable, CustAccount));
br.value("4008");
ds.addSortField(FieldNum(SalesTable, SalesId));

qr = new QueryRun(q);


if(qr.prompt())
{
while(qr.next())
{
st = qr.get(TableNum(SalesTable));
print st.CustAccount;
print st.SalesId;
}
}

When I execute this code the I can not change the range value. The field is
simply locked in the dialog that appears when I call qr.promt() How can i
make the range field editable for the user?

"Thomaslp" wrote:

> Hi,
>
> I have created a query from scratch. When I call the qr.promt() method I
> cant change the value that I have defined through the qbr.value() method. How
> do I enable this?
>
> Also I think that the dialog that appears is pretty lousy. Is there some way
> to call the standard query dialog through some super call or??

Steen Andreasen

2/8/2006 7:58:00 PM

0

Hi Thomaslp,

The query Cust has the property user updates set to false. You can
override the setting by adding the following line:

q.userUpdate(true);

Best Regards
Steen Andreasen
http://www.steenandreasen.com/axap...

Thomaslp wrote:

>Since I got no response I will try to be more specific. I have the following
>code:
>
> SalesTable st;
> Query q = new Query(QueryStr(Cust));
> QueryRun qr;
> QueryBuildDataSource ds = q.addDataSource(TableNum(SalesTable));
> QueryBuildRange br = ds.addRange(FieldNum(SalesTable, CustAccount));
> br.value("4008");
> ds.addSortField(FieldNum(SalesTable, SalesId));
>
> qr = new QueryRun(q);
>
>
> if(qr.prompt())
> {
> while(qr.next())
> {
> st = qr.get(TableNum(SalesTable));
> print st.CustAccount;
> print st.SalesId;
> }
> }
>
>When I execute this code the I can not change the range value. The field is
>simply locked in the dialog that appears when I call qr.promt() How can i
>make the range field editable for the user?
>
>"Thomaslp" wrote:
>
>
>
>>Hi,
>>
>>I have created a query from scratch. When I call the qr.promt() method I
>>cant change the value that I have defined through the qbr.value() method. How
>>do I enable this?
>>
>>Also I think that the dialog that appears is pretty lousy. Is there some way
>>to call the standard query dialog through some super call or??
>>
>>

--

Alexander Usachev

2/8/2006 8:01:00 PM

0

>
> SalesTable st;
> Query q = new Query(QueryStr(Cust));
replace this line by : Query q = new Query();

> QueryRun qr;
> QueryBuildDataSource ds = q.addDataSource(TableNum(SalesTable));
> QueryBuildRange br = ds.addRange(FieldNum(SalesTable, CustAccount));
> br.value("4008");
> ds.addSortField(FieldNum(SalesTable, SalesId));
>
> qr = new QueryRun(q);
>
>
> if(qr.prompt())
> {
> while(qr.next())
> {
> st = qr.get(TableNum(SalesTable));
> print st.CustAccount;
> print st.SalesId;
> }
> }
>
> When I execute this code the I can not change the range value. The field
> is
> simply locked in the dialog that appears when I call qr.promt() How can i
> make the range field editable for the user?
>
> "Thomaslp" wrote:
>
>> Hi,
>>
>> I have created a query from scratch. When I call the qr.promt() method I
>> cant change the value that I have defined through the qbr.value() method.
>> How
>> do I enable this?
>>
>> Also I think that the dialog that appears is pretty lousy. Is there some
>> way
>> to call the standard query dialog through some super call or??


Thomaslp

2/8/2006 8:14:00 PM

0

Hello Steen and Alexander,

thank you for your help. Both of your solutions works. But can you explain
to me what the Query(QueryStr(Cust)) actually do?

Thomas


"Alexander Usachev" wrote:

> >
> > SalesTable st;
> > Query q = new Query(QueryStr(Cust));
> replace this line by : Query q = new Query();
>
> > QueryRun qr;
> > QueryBuildDataSource ds = q.addDataSource(TableNum(SalesTable));
> > QueryBuildRange br = ds.addRange(FieldNum(SalesTable, CustAccount));
> > br.value("4008");
> > ds.addSortField(FieldNum(SalesTable, SalesId));
> >
> > qr = new QueryRun(q);
> >
> >
> > if(qr.prompt())
> > {
> > while(qr.next())
> > {
> > st = qr.get(TableNum(SalesTable));
> > print st.CustAccount;
> > print st.SalesId;
> > }
> > }
> >
> > When I execute this code the I can not change the range value. The field
> > is
> > simply locked in the dialog that appears when I call qr.promt() How can i
> > make the range field editable for the user?
> >
> > "Thomaslp" wrote:
> >
> >> Hi,
> >>
> >> I have created a query from scratch. When I call the qr.promt() method I
> >> cant change the value that I have defined through the qbr.value() method.
> >> How
> >> do I enable this?
> >>
> >> Also I think that the dialog that appears is pretty lousy. Is there some
> >> way
> >> to call the standard query dialog through some super call or??
>
>
>

Steen Andreasen

2/8/2006 8:42:00 PM

0

Querystr(Cust) refer to the query Cust created in the AOT under the Queries node.
If creating your query object using an existing query as parameters you will be extending this query.
If you create your query object without any parameter, query = new Query(), you will build a new query from scratch.

Best Regards
Steen Andreasen
http://www.steenandreasen.com/axap...


Thomaslp wrote:

>Hello Steen and Alexander,
>
>thank you for your help. Both of your solutions works. But can you explain
>to me what the Query(QueryStr(Cust)) actually do?
>
>Thomas
>
>
>"Alexander Usachev" wrote:
>
>
>
>>> SalesTable st;
>>> Query q = new Query(QueryStr(Cust));
>>>
>>>
>>replace this line by : Query q = new Query();
>>
>>
>>
>>> QueryRun qr;
>>> QueryBuildDataSource ds = q.addDataSource(TableNum(SalesTable));
>>> QueryBuildRange br = ds.addRange(FieldNum(SalesTable, CustAccount));
>>> br.value("4008");
>>> ds.addSortField(FieldNum(SalesTable, SalesId));
>>>
>>> qr = new QueryRun(q);
>>>
>>>
>>> if(qr.prompt())
>>> {
>>> while(qr.next())
>>> {
>>> st = qr.get(TableNum(SalesTable));
>>> print st.CustAccount;
>>> print st.SalesId;
>>> }
>>> }
>>>
>>>When I execute this code the I can not change the range value. The field
>>>is
>>>simply locked in the dialog that appears when I call qr.promt() How can i
>>>make the range field editable for the user?
>>>
>>>"Thomaslp" wrote:
>>>
>>>
>>>
>>>>Hi,
>>>>
>>>>I have created a query from scratch. When I call the qr.promt() method I
>>>>cant change the value that I have defined through the qbr.value() method.
>>>>How
>>>>do I enable this?
>>>>
>>>>Also I think that the dialog that appears is pretty lousy. Is there some
>>>>way
>>>>to call the standard query dialog through some super call or??
>>>>
>>>>
>>
>>
>>

--