题
当斧头生成表单和网格时,所有查找都会正确填充,但是查找项目的ID以表单显示。看到有意义的值的唯一方法是单击字段 - 不是真正的理想。有没有办法以形式显示查找值,而不是其背后的ID号?
我希望“ tableb”表单显示tablea_value而不是tablea_id。
tablea
- tablea_id(int-唯一)
- tablea_value(字符串 - 非唯一)
表格
- tableb_id(int-唯一)
- tablea_id(int-与tablea的关系)
- tableb_datafields(MISC)
谢谢
解决方案
找不到一种方法来更改查找本身的价值,因此我将静态字段放在旁边,该字段在更改查找时会更新。这是我最终这样做的方式:
表A上的显示方法:
display [datatype] lookupName(tableA _tableA)
{
;
return tableB::find(_tableA.[tableA id column]).[tableB string column];
}
在表B上找到方法:
static tableB find([datatype] [lookup variable], boolean _forUpdate = false,
ConcurrencyModel _concurrencyModel = ConcurrencyModel::Auto)
{
[TableB] [tableB];
if ([lookup variable])
{
if (_forUpdate)
{
tableB.selectForUpdate(_forUpdate);
if (_concurrencyModel != ConcurrencyModel::Auto)
{
tableB.concurrencyModel(_concurrencyModel);
}
}
select firstonly tableB
where tableB.[lookup column] == [lookup variable];
}
return tableB;
}
添加了表A和B作为表单的数据源。
向表单添加了一个字符串字段。
将表A作为字段的数据源和查找名称作为数据模具。
在查找字段中添加了一个修改的方法,以使静态字段更新:
element.redraw();
希望这对某人有帮助。
不隶属于 StackOverflow