ulisses
ulisses

Reputation: 1581

How to set from code the query range in Query object?

I created a query in the AOT (and open it with a View).

I want to set the queryRange in my Query object from code . In my init method I used this code :

Query q = new Query();
QueryRun qr;
QueryBuildDataSource qbds;

qbds = q.addDataSource(tableNum(MyTable));
qbds.addRange(fieldNum(MyTable, MyField)).value(SysQuery::valueUnlimited() ) ;
qr = new QueryRun (q) ;

But when I launch a View I don't see this query, the promt only shows the query with index-field. It's possible to set the range from code ?

Upvotes: 1

Views: 4973

Answers (1)

Maxim Lazarev
Maxim Lazarev

Reputation: 1254

Instead of creating new query, use objects query:

public void init()
{
    super();
    query.dataSourceNo(1).addRange(fieldNum(MyTable, MyField)).value(SysQuery::valueUnlimited());
}

Upvotes: 4

Related Questions