How we can fetch data using table id or not ?????

i have scenario in which i want excess data using table id… So please tell me it is possible or not…

For Ex.

TableName TableName = “CustTable”;

While Select TableName

{

// code for my logic…

}

after compilation i will get these error

Table TableName doesn’t exist // because in AOT TableName table doesn’t exist in Table…

2nd scenario

TableName TableName = “CustTable”;

DictTable dictTable;

dictTable = new DictTable(tableName2id(TableName));

while select tableId2name(dictTable.id())
{
// code for my logic
}

in these case i will get syntax error

So,please tell me it is possible or not in these case to excess data; if possible then tell me reliable logic for that…

DictTable dictTable;
Common common;
DictField dictField = new DictField(tableNum(CustTable), fieldNum(CustTable, AccountNum));

dictTable = new DictTable(tableNum(CustTable));

common = dictTable.makeRecord();

while select common
where common.(dictField.id()) like “US*”
{
info(common.(dictField.id()));
}

thanks kranthi …it’s work but please tell me how we group by record

For Ex ;
in my case , i wan’t

while select Common group by common.(dictField.id())
{
// code for my logic
}

I don’t think you can do that with in a select statement, but you can use the query frame work to do that.

Query query;
QueryBuildDataSource qbds;
QueryRun qr;
DictTable dictTable;
Common common;
DictField dictField = new DictField(tableNum(CustTable), fieldNum(CustTable, CustGroup));

dictTable = new DictTable(tableNum(CustTable));
common = dictTable.makeRecord();

query = new query();

qbds = query.addDataSource(dictTable.id());
qbds.addGroupByField(dictField.id());

qr = new QueryRun(query);

while (qr.next())
{
common = qr.get(dictTable.id());

info(common.(dictField.id()));
}