Add range in job using axapta

Add range in job using axapta

static void JobForRangeInAx(Args _args)
{
// variable declaration
str string;
Query query;
QueryRun queryRun;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
CustTable custTable;
;
//start logic of program
if ( hasSecurityKeyAccess(securityKeyNum(SysDevelopment),
AccessType::Edit) )
{
query = new Query();
queryBuildDataSource = query.addDataSource(TableNum(CustTable));

queryBuildRange = queryBuildDataSource.addRange(FieldNum(CustTable,AccountNum));

queryBuildRange.value("1000..2000");
queryRun = new queryRun(query);

if (queryRun.prompt())
{
while (queryRun.next())
{
custTable = queryRun.get(TableNum(CustTable));
print custTable.AccountNum;
}
}
}

select count(Name) from custTable;
string = custTable.Name;
Box::info(string,'title','help');
}