static void table2FieldsList(Common _TableName,boolean _Formatted=true,str _TableName1="",str _TableName2="",int _NumberOfTab=1,int64 _RecId =0)
{
DictTable dicttab;
sysDictField field;
str EnumName;
str TabCaracter="";
int space = 52;//one tab 4 char
str ListOfField ='\n';
int i;
if(_RecId)
{
select firstonly _TableName
where _TableName.RecId == _RecId;
}
else
{
select firstonly _TableName;
}
for (i=1;i<=_NumberOfTab;i++)
{
TabCaracter+=" ";
}
dicttab=new DictTable(_TableName.TableId);
for (i=1;i<=dicttab.fieldCnt();i++)
{
field=new sysDictField(dicttab.id(),dicttab.fieldCnt2id(i));
if(enumId2Name(field.enumId()))
EnumName = int2str(enum2int(_TableName.getFieldValue(fieldId2name(_TableName.TableId,field.id()))))+";//"+enumId2Name(field.enumId())+"::"+enum2Value(_TableName.getFieldValue(fieldId2name(_TableName.TableId,field.id())));
else
{
EnumName = _TableName.getFieldValue(fieldId2name(_TableName.TableId,field.id()));
if(!isInteger(EnumName))
EnumName = '"'+EnumName+'"';
}
if(_Formatted)
ListOfField +=TabCaracter+strLFix(tableId2name(_TableName.TableId)+"."+fieldId2name(_TableName.TableId,field.id()),space," ")+'= '+EnumName+';\n';
else
ListOfField +=TabCaracter+strLFix(_TableName1+"."+fieldId2name(_TableName.TableId,field.id()),space," ")+"= "+_TableName2+"."+fieldId2name(_TableName.TableId,field.id())+";\n";
}
checkFailed(ListOfField);
}
Aucun commentaire:
Enregistrer un commentaire