protected void AddField(tableId tableId,
fieldId fieldId,
FormBuildDataSource formBuildDataSource,
FormBuildGridControl formBuildGridControl,
boolean allowControlEdit)
{
FormBuildStringControl formBuildStringControl;
Object formBuildControl;
SysDictField dictField;
int j;
// WIK -->
FormControlType formControlType;
// WIK <--
;
dictField = new SysDictField(tableId, fieldId);
if (dictField.saveContents())
{
// (...)
formBuildControl.displayLengthValue(5);
formBuildControl.lookupButton(2);
}
}
// WIK -->
if (! dictField.visible())
{
switch (dictField.baseType())
{
case Types::Integer : formControlType = FormControlType::Integer; break;
case Types::Int64 : formControlType = FormControlType::Int64; break;
case Types::Guid : formControlType = FormControlType::Guid; break;
case Types::Real : formControlType = FormControlType::Real; break;
case Types::Date : formControlType = FormControlType::Date; break;
case Types::Time : formControlType = FormControlType::Time; break;
case Types::UtcDateTime : formControlType = FormControlType::DateTime; break;
default : formControlType = FormControlType::String;
}
formBuildControl = formBuildGridControl.addControl(formControlType, dictField.name());
formBuildControl.label(dictField.name());
formBuildControl.colorScheme(FormColorScheme::RGB);
formBuildControl.backgroundColor(WinAPI::rgb2int(220, 70, 70));
formBuildControl.helpText(dictField.label());
formBuildControl.allowEdit(false);
}
// WIK <--
}
}
}
public void init()
{
QueryBuildDataSource qbds;
;
super();
qbds = TmpSysTableBrowser_ds.query().dataSourceTable(tablenum(TmpSysTableBrowser));
// QueryBuildRange qbr -- Global declaration
qbr = SysQuery::findOrCreateRange(qbds, fieldnum(TmpSysTableBrowser, RefRecId));
}
public int active()
{
TmpSysTableBrowser tmpSysTableBrowserLocal;
DictTable dictTableLocal;
SysDictField dictField;
int i;
int fieldCnt;
int ret;
;
ret = super();
element.lockWindowUpdate(true);
dictTableLocal = new DictTable(ds.TableId);
fieldCnt = dictTableLocal.fieldCnt();
for (i = 1; i <= fieldCnt; i++)
{
dictField = new SysDictField(ds.TableId, dictTableLocal.fieldCnt2Id(i));
if (dictField && ! dictField.visible())
{
tmpSysTableBrowserLocal.clear();
switch (dictField.baseType())
{
case Types::Integer :
tmpSysTableBrowserLocal.IntegerValue = ds.(dictField.id());
TmpSysTableBrowser_IntegerValue.visible(true);
break;
case Types::Guid :
tmpSysTableBrowserLocal.GuidValue = ds.(dictField.id());
TmpSysTableBrowser_GuidValue.visible(true);
break;
case Types::Real :
tmpSysTableBrowserLocal.RealValue = ds.(dictField.id());
TmpSysTableBrowser_RealValue.visible(true);
break;
case Types::Date :
tmpSysTableBrowserLocal.DateValue = ds.(dictField.id());
TmpSysTableBrowser_DateValue.visible(true);
break;
case Types::Time :
tmpSysTableBrowserLocal.TimeValue = ds.(dictField.id());
TmpSysTableBrowser_TimeValue.visible(true);
break;
case Types::UtcDateTime :
tmpSysTableBrowserLocal.DateTimeValue = ds.(dictField.id());
TmpSysTableBrowser_DateTimeValue.visible(true);
break;
case Types::Int64 :
tmpSysTableBrowserLocal.Int64Value = ds.(dictField.id());
TmpSysTableBrowser_Int64Value.visible(true);
break;
case Types::Container :
tmpSysTableBrowserLocal.StringValue = con2str(ds.(dictField.id()));
TmpSysTableBrowser_StringValue.visible(true);
break;
default :
tmpSysTableBrowserLocal.StringValue = strfmt('%1', ds.(dictField.id()));
TmpSysTableBrowser_StringValue.visible(true);
}
tmpSysTableBrowserLocal.FieldName = dictField.name();
tmpSysTableBrowserLocal.FieldLabel = dictField.label();
tmpSysTableBrowserLocal.DictTableId = dictTableLocal.id();
tmpSysTableBrowserLocal.FieldId = dictField.id();
tmpSysTableBrowserLocal.RefRecId = ds.RecId;
tmpSysTableBrowserLocal.insert();
}
}
if (tmpSysTableBrowserLocal)
{
qbr.value(SysQuery::value(ds.RecId));
TmpSysTableBrowser.setTmpData(tmpSysTableBrowserLocal);
TmpSysTableBrowser_ds.executeQuery();
TmpGrid.visible(true);
}
element.lockWindowUpdate(false);
return ret;
}
Labels: Dynamics AX 2009, SysTableBrowser, Table browser, X++