Skip to content

Instantly share code, notes, and snippets.

@tommykakashi
Last active December 14, 2015 15:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tommykakashi/5106614 to your computer and use it in GitHub Desktop.
Save tommykakashi/5106614 to your computer and use it in GitHub Desktop.
Build a Query in X++
Query query;
QueryRun qr;
QueryBuildRange qbr;
QueryBuildDataSource qbds, bdsInventDim;
query = new Query();
qbds = query.addDataSource(tableNum(PriceDiscGroup));
qbdsInventDim = qbds.addDataSource(tableNum(InventDim));
qbdsInventDim.addLink(fieldNum(PriceDiscAdmTrans, InventDimId), fieldNum(InventDim, InventDimId));
qbdsInventDim.joinMode(JoinMode::InnerJoin);
qbdsInventDim.addOrderByField(fieldNum(InventDim, InventColorId));
qbr = qbds.addRange(fieldNum(PriceDiscGroup, Type));
qbr.value(queryValue(priceGroupType));
qr = new QueryRun(query);
while (qr.next())
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment