Re: Set report ranges using code..?
Hello,
I see what you are saying. Basically, if you start from a menu item with NO record, you want to basically NOT use what is stored in usage data. At that point, couldn't you do something like this:
public void init()
{
CustTable ct;
;
super();
if (element.args().record())
{
this.query().dataSourceTable(TableNum(CustTable)).addRange(FieldNum(CustTable,Name)).value(ct.Name);
}
else
{
this.query().datasourceTable(TableNum(CustTable)).addRange(FieldNum(CustTable,Name)).value("");
}
}
Granted, the range value would hav to make sense based on the field(s) being cleared, but I would think the above would be acceptible. Otherwise, you may want to override the unpack method of the report to not get the usage data if the record in args() is empty as well.
Please keep us posted.
Best regards
Bill 'Luther' Thompson
Microsoft Online Support Engineer - MBS Dynamics AX Developer Support
=============================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
=============================================