One method
1-1) using common by tableId and recId
public Common findRecord(TableId _tableId, RecId _recId, Boolean _forUpdate = false)
{
Common common;
DictTable dictTable;
;
dictTable = new DictTable(_tableId);
common = dictTable.makeRecord();
common.selectForUpdate(_forUpdate);
select common
where common.RecId == _recId;
return common;
}
1-2) using query
Query q = new Query;
QueryBuildDatasource qbds;
QueryRun qr;
;
qbds = q.addDataSouce(tableid);
qbds.addRange(tableid2name(tableid), RecId)).value(queryValue
(yourrecid));
qr = new QueryRun(q);
if (queryRun.next())
{
common = qr.get(tableid);
}
1-3)using loop Dictionary
Dictionary dictionary;
TableId tableId;
tableName tableName;
common c;
DictTable dt;
;
dictionary = new Dictionary();
tableId = dictionary.tableNext(0);
tableName = dictionary.tableName(tableId);
while (tableId)
{
//info(strfmt("%1 - %2",int2str(tableId), tableName));
tableId = dictionary.tableNext(tableId);
tableName = dictionary.tableName(tableId);
dt = new DictTable(tableId);
c=dt.makeRecord();
select c where c.RecId==53883;
if(c)
{
info(strfmt("%1 - %2",int2str(tableId), tableName));
break;
}
}
Two method
SQLDictionary dictTable;
common c;
DictTable dt;
;
while select * from dictTable where dictTable.fieldId == 0
{
//info(strfmt("%1 - %2", dicttable.name ,dicttable.tabId));
dt = new DictTable(dictTable.tabId);
c=dt.makeRecord();
select c where c.RecId==53883;
if(c)
{
info(strfmt("%1 - %2", dicttable.name ,dicttable.tabId));
break;
}
}
/* incompleted
UtilIdElements uie;
common c;
DictTable dt;
;
while select uie where uie.recordType==utilelementtype::Table
//&& uie.utilLevel==UtilEntryLevel::usr
{
info(strfmt("%1 --- %2",uie.name , uie.id));
dt = new DictTable(uie.id);
c=dt.makeRecord();
select c where c.RecId==53883;
if(c)
{
print uie.name;
break;
}
}
*/
没有评论:
发表评论