[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.axapta.programming

InventUpd_Reservation.updateReserveMore

frango

10/27/2005 10:13:00 PM

Hello,

I would like to use a standard field (WMSLocation.SortCode) to add priority
to warehouse locations in the reservation process (instead of the standard
which is based on alphabetical order of WMSLocationId). It does not work.
What's wrong in the following piece of code? Does it have something to see
with the fact that InventDim has a GroupBy and thus non-grouped fields of
InventDim are 'blank'?

InventUpd_Reservation.updateReserveMore()
....
// Priority - begin
qbdsWMSLocation =
query.dataSourceTable(TableNum(InventDim)).addDataSource(tablenum(WMSLocation));

qbdsWMSLocation.relations(true);

qbdsWMSLocation.addSortField(fieldnum(WMSLocation, sortCode),
SortOrder::Ascending);

qbdsWMSLocation.orderMode(OrderMode::GroupBy);
// end

queryRun = new QueryRun(query);

doNext = queryRun.next();
tmpReserved = 0;

while (doNext)
....


Note : To block locations based on a parameter
(WMSLocation.BlockedForReservation), I also added the following line :

qbdsWMSLocation.addRange(fieldnum(WMSLocation,
BlockedForReservation)).value(queryValue(NoYes::No));

This works fine!
Thank you in advance,

François


1 Answer

Luegisdorf

10/28/2005 8:11:00 AM

0

Hi Frango

Questions:
- Why you use groupBy if you don''t add any field (like sum of this or that)?
- Is the qbdsWMSLocation the master table in the query?

the Hint:
May be you can solve your problem if you add qbdsWMSLocation.clearSort()
before you add a new sortfield.

Best regards
Patrick


InventUpd_Reservation.updateReserveMore()
....
// Priority - begin
qbdsWMSLocation =
query.dataSourceTable(TableNum(InventDim)).addDataSource(tablenum(WMSLocation));

qbdsWMSLocation.relations(true);

qbdsWMSLocation.addSortField(fieldnum(WMSLocation, sortCode),
SortOrder::Ascending);

qbdsWMSLocation.orderMode(OrderMode::GroupBy);
// end

queryRun = new QueryRun(query);

doNext = queryRun.next();
tmpReserved = 0;

while (doNext)
....


"frango" wrote:

> Hello,
>
> I would like to use a standard field (WMSLocation.SortCode) to add priority
> to warehouse locations in the reservation process (instead of the standard
> which is based on alphabetical order of WMSLocationId). It does not work.
> What''s wrong in the following piece of code? Does it have something to see
> with the fact that InventDim has a GroupBy and thus non-grouped fields of
> InventDim are ''blank''?
>
> InventUpd_Reservation.updateReserveMore()
> ...
> // Priority - begin
> qbdsWMSLocation =
> query.dataSourceTable(TableNum(InventDim)).addDataSource(tablenum(WMSLocation));
>
> qbdsWMSLocation.relations(true);
>
> qbdsWMSLocation.addSortField(fieldnum(WMSLocation, sortCode),
> SortOrder::Ascending);
>
> qbdsWMSLocation.orderMode(OrderMode::GroupBy);
> // end
>
> queryRun = new QueryRun(query);
>
> doNext = queryRun.next();
> tmpReserved = 0;
>
> while (doNext)
> ...
>
>
> Note : To block locations based on a parameter
> (WMSLocation.BlockedForReservation), I also added the following line :
>
> qbdsWMSLocation.addRange(fieldnum(WMSLocation,
> BlockedForReservation)).value(queryValue(NoYes::No));
>
> This works fine!
> Thank you in advance,
>
> François
>
>