我想创建3个表及其字段的查找,我的要求是在第一个字段中我想显示3个表名作为查找而在第二个字段中我将显示表的所有字段在第一个字段中选择。
例如,如果我在第一个字段的查找中有Route,sales basket和Invent表,我在第一个字段中选择Invent表,然后在第二个字段中我必须显示发明表的所有字段作为查找。请在这方面帮助我。
我已尝试使用正常流程查找但无法成功,请帮我找到正确的方向
答案 0 :(得分:1)
TableId tableId = pickTable();
FieldId fieldId = pickField(tableId);
info(tableId2name(tableId));
info(fieldId2name(tableId, fieldId));
OR
public void lookup()
{
SysTableLookup sysTableLookup;
SysDictField sysDictField;
TmpTableFieldLookup tmpTableFieldLookup;
Enumerator en;
super();
en = SysDictTable::newName(tableStr(InventTable)).fields(false, true, false).getEnumerator();
while (en.moveNext())
{
sysDictField = en.current();
tmpTableFieldLookup.TableName = sysDictField.tableName();
tmpTableFieldLookup.FieldMethodName = sysDictField.name();
tmpTableFieldLookup.insert();
}
sysTableLookup = SysTableLookup::newParameters(tableNum(tmpTableFieldLookup), this);
sysTableLookup.addLookupfield(fieldNum(TmpTableFieldLookup, TableName));
sysTableLookup.addLookupfield(fieldNum(TmpTableFieldLookup, FieldMethodName), true);
//BP Deviation documented
sysTableLookup.parmTmpBuffer(tmpTableFieldLookup);
sysTableLookup.performFormLookup();
}
答案 1 :(得分:1)
表名查找:
public void lookupTableName(FormControl _formControl)
{
container validTableNames = [tableStr(Route), tableStr(SalesBasket), tableStr(InventTable)];
SysTableLookup sysTableLookup;
Query q;
QueryBuildDataSource qbds;
sysTableLookup = SysTableLookup::newParameters(tablenum(SysModelElement), _formControl);
sysTableLookup.addLookupfield(fieldnum(SysModelElement, Name));
sysTableLookup.addLookupfield(fieldnum(SysModelElement, AxId));
q = new Query();
qbds = q.addDataSource(tablenum(SysModelElement));
qbds.addRange(fieldnum(SysModelElement, Name)).value(con2Str(validTableNames));
qbds = qbds.addDataSource(tablenum(SysModelElementType));
qbds.addRange(fieldnum(SysModelElementType, Name)).value(SysQuery::value(UtilElementType::Table));
qbds.relations(true);
sysTableLookup.parmQuery(q);
sysTableLookup.performFormLookup();
}
字段名称查找:
public void lookupFieldName(FormControl _formControl, RefTableId _refTableId)
{
SysTableLookup sysTableLookup;
Query q;
QueryBuildDataSource qbds;
sysTableLookup = SysTableLookup::newParameters(tablenum(SysModelElement), _formControl);
sysTableLookup.addLookupfield(fieldnum(SysModelElement, Name));
sysTableLookup.addLookupfield(fieldnum(SysModelElement, AxId));
q = new Query();
qbds = q.addDataSource(tablenum(SysModelElement));
qbds.addRange(fieldnum(SysModelElement, ParentId)).value(queryValue(_refTableId));
qbds = qbds.addDataSource(tablenum(SysModelElementType));
qbds.addRange(fieldnum(SysModelElementType, Name)).value(SysQuery::value(UtilElementType::TableField));
qbds.relations(true);
sysTableLookup.parmQuery(q);
sysTableLookup.performFormLookup();
}