Hi
If you need to create a range in the init method of the datasource of your field but you want to apply it not to all records only for some according to the value of another field check this example and follow the links below ;)
public void init()
{
Query query;
BOM BOM;
queryrun qr;
Qty qtySched;
QueryBuildRange queryBuildRange1, queryBuildRange2;
;
super();
if ( element.args().caller() &&
element.args().dataset() == tablenum(ProdTable))
{
qtySched = ProdTable::find(element.prodId()).QtySched;
queryBuildRange1 = ProdBOM_ds.query().dataSourceTable(tablenum(ProdBOM)).addRange(fieldnum(ProdBOM,Thy_Package));
queryBuildRange1.value(strfmt('(%1 == 0) || (%1 == 1) && (%2 <= %3)',fieldstr(ProdBOM, Thy_Package), fieldstr(ProdBOM, Thy_limitPackage), int2str(qtySched)));
}
}
{
Query query;
BOM BOM;
queryrun qr;
Qty qtySched;
QueryBuildRange queryBuildRange1, queryBuildRange2;
;
super();
if ( element.args().caller() &&
element.args().dataset() == tablenum(ProdTable))
{
qtySched = ProdTable::find(element.prodId()).QtySched;
queryBuildRange1 = ProdBOM_ds.query().dataSourceTable(tablenum(ProdBOM)).addRange(fieldnum(ProdBOM,Thy_Package));
queryBuildRange1.value(strfmt('(%1 == 0) || (%1 == 1) && (%2 <= %3)',fieldstr(ProdBOM, Thy_Package), fieldstr(ProdBOM, Thy_limitPackage), int2str(qtySched)));
}
}
Aucun commentaire:
Enregistrer un commentaire