In the Purchtable
form I have a StringEdit
control.
When I type a PurchId
in the StringEdit
co开发者_JAVA技巧ntrol, it should act as a search and should retrieve the current PurchId in the Grid.
Add a modified method to the controls method node:
public boolean modified()
{
boolean ret = super();
;
SysQuery::findOrCreateRange(purchTable_ds.queryRun().query().dataSourceNo(1), fieldNum(PurchTable,PurchId)).value(this.text());
purchTable_ds.research();
return ret;
}
This will add a PurchId
query range to the PurchTable
data source, fill it with your entered value, then do a research on the data source.
You can accept Jan's answer, there's only a minor correction I want to add - I don't think it'll work with research
, should be executeQuery
instead:
public boolean modified()
{
Query q;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
boolean ret;
;
ret = super();
q = purchTable_ds.queryRun().query();
qbds = q.dataSourceTable(tablenum(PurchTable));
qbr = SysQuery::findOrCreateRange(qbds, fieldNum(PurchTable,PurchId));
qbr.value(this.text());
PurchTable_ds.executeQuery();
return ret;
}
Test it, anyway.
精彩评论