[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

microsoft.public.axapta.programming

Query Builder Question

ejlwolf

12/5/2005 8:50:00 PM

Is there a way to build a QueryBuildRange with an OR on 2 tables (see sql
statement below for better description)?

I want to create a query dynamically with the same results as the sql
statement in the code below. Basically if InventSum.OnOrder == 0 OR
InventDim.InventLocationID == some location.

void GetOnHand(InventLocationId loc)
{
InventSum invSum;
InventDim invDim;
while select invSum join invDim
where invSum.InventDimId == invDim.inventDimId &&
invSum.AvailPhysical > 0 &&
(invSum.OnOrder == 0 || invDim.InventLocationId == loc)
{
print invDim.inventSerialId + ' ' + invDim.InventLocationId + '
' + int2str(invSum.OnOrder);
}
}

Thanks,
1 Answer

rheu

12/6/2005 8:31:00 AM

0

Try the following:
Add a range (qbr) on field DataAreaId on datasource InventDim.
qbr.value(strFmt('(InventSum.OnOrder == 0) || (InventLocationId == 'loc')'));

The single-quotes and parenthesis are important, don't forget them. For
fields in the current table, simply the fieldname can be used (like
InventLocationId). For fields in other tables, a prefix of the datasource
name must be added (can be different from table name.

See also: http://www.axaptapedia.com/index.php/Expressions_in_qu...

Rob

"ejlwolf" wrote:

> Is there a way to build a QueryBuildRange with an OR on 2 tables (see sql
> statement below for better description)?
>
> I want to create a query dynamically with the same results as the sql
> statement in the code below. Basically if InventSum.OnOrder == 0 OR
> InventDim.InventLocationID == some location.
>
> void GetOnHand(InventLocationId loc)
> {
> InventSum invSum;
> InventDim invDim;
> while select invSum join invDim
> where invSum.InventDimId == invDim.inventDimId &&
> invSum.AvailPhysical > 0 &&
> (invSum.OnOrder == 0 || invDim.InventLocationId == loc)
> {
> print invDim.inventSerialId + ' ' + invDim.InventLocationId + '
> ' + int2str(invSum.OnOrder);
> }
> }
>
> Thanks,