-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
55 output enum int values instead ofas well as strings (#69)
- Loading branch information
Showing
7 changed files
with
338 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
table 82567 "ADLSE Enum Translation" | ||
{ | ||
DataClassification = ToBeClassified; | ||
Caption = 'ADLSE Enum Translation'; | ||
Access = Internal; | ||
|
||
fields | ||
{ | ||
field(1; "Table Id"; Integer) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Table Id'; | ||
} | ||
field(2; "Compliant Table Name"; Text[40]) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Compliant Table Name'; | ||
} | ||
field(3; "Field Id"; Integer) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Field Id'; | ||
} | ||
field(4; "Compliant Field Name"; Text[40]) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Compliant Object Name'; | ||
} | ||
} | ||
|
||
keys | ||
{ | ||
key(Key1; "Table Id", "Field Id") | ||
{ | ||
Clustered = true; | ||
} | ||
} | ||
|
||
local procedure InsertEnum(TableId: Integer; FieldNo: Integer; FieldName: Text[30]) | ||
var | ||
ADLSEUtil: Codeunit "ADLSE Util"; | ||
begin | ||
Rec.Init(); | ||
Rec."Table Id" := TableId; | ||
Rec."Compliant Table Name" := CopyStr(ADLSEUtil.GetDataLakeCompliantTableName(TableId), 1, MaxStrLen((Rec."Compliant Table Name"))); | ||
Rec."Field Id" := FieldNo; | ||
Rec."Compliant Field Name" := CopyStr(ADLSEUtil.GetDataLakeCompliantFieldName(FieldName, FieldNo), 1, MaxStrLen((Rec."Compliant Field Name"))); | ||
Rec.Insert(); | ||
end; | ||
|
||
procedure RefreshOptions() | ||
var | ||
ADLSETable: Record "ADLSE Table"; | ||
ADLSEEnumTranslation: Record "ADLSE Enum Translation"; | ||
ADLSEEnumTranslationLang: Record "ADLSE Enum Translation Lang"; | ||
RecordField: Record Field; | ||
ADLSERecordRef: RecordRef; | ||
begin | ||
ADLSEEnumTranslation.DeleteAll(); | ||
ADLSEEnumTranslationLang.DeleteAll(); | ||
|
||
if ADLSETable.FindSet() then | ||
repeat | ||
RecordField.SetRange(TableNo, ADLSETable."Table ID"); | ||
RecordField.SetRange("Type", RecordField."Type"::Option); | ||
RecordField.SetFilter(ObsoleteState, '<>%1', RecordField.ObsoleteState::Removed); | ||
ADLSERecordRef.Open(ADLSETable."Table ID"); | ||
if RecordField.FindSet() then | ||
repeat | ||
InsertEnums(ADLSERecordRef, RecordField); | ||
until RecordField.Next() = 0; | ||
ADLSERecordRef.Close(); | ||
until ADLSETable.Next() = 0; | ||
|
||
if not ADLSETable.Get(Rec.RecordId.TableNo) then begin | ||
ADLSETable.Add(Rec.RecordId.TableNo); | ||
ADLSETable.AddAllFields(); | ||
end; | ||
if not ADLSETable.Get(ADLSEEnumTranslationLang.RecordId.TableNo) then begin | ||
ADLSETable.Add(ADLSEEnumTranslationLang.RecordId.TableNo); | ||
ADLSETable.AddAllFields(); | ||
end; | ||
end; | ||
|
||
local procedure InsertEnums(ADLSERecordRef: RecordRef; FieldRec: Record Field) | ||
var | ||
ADLSESetup: Record "ADLSE Setup"; | ||
ADLSEEnumTranslationLang: Record "ADLSE Enum Translation Lang"; | ||
TranslationHelper: Codeunit "Translation Helper"; | ||
FieldRef: FieldRef; | ||
i: Integer; | ||
x: Integer; | ||
Translations: List of [Text]; | ||
begin | ||
ADLSESetup.GetSingleton(); | ||
FieldRef := ADLSERecordRef.Field(FieldRec."No."); | ||
InsertEnum(FieldRec.TableNo, FieldRec."No.", FieldRec.FieldName); | ||
for i := 1 to FieldRef.EnumValueCount() do begin | ||
//Insert language captions | ||
Translations := ADLSESetup.Translations.Split(';'); | ||
Translations.Remove(''); | ||
for x := 1 to Translations.Count() do begin | ||
TranslationHelper.SetGlobalLanguageByCode(Translations.Get(x)); | ||
ADLSEEnumTranslationLang.InsertEnumLanguage(Translations.Get(x), FieldRec.TableNo, FieldRec."No.", FieldRec.FieldName, FieldRef.GetEnumValueOrdinal(i), FieldRef.GetEnumValueCaption(i)); | ||
end; | ||
end; | ||
TranslationHelper.RestoreGlobalLanguage(); | ||
end; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
table 82568 "ADLSE Enum Translation Lang" | ||
{ | ||
DataClassification = ToBeClassified; | ||
Caption = 'ADLSE Enum Translation Language'; | ||
Access = Internal; | ||
|
||
fields | ||
{ | ||
field(1; "Language Code"; Code[10]) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Language Code'; | ||
} | ||
field(2; "Table Id"; Integer) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Table Id'; | ||
} | ||
field(3; "Compliant Table Name"; Text[40]) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Compliant Table Name'; | ||
} | ||
field(4; "Field Id"; Integer) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Field Id'; | ||
} | ||
field(5; "Compliant Field Name"; Text[40]) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Compliant Object Name'; | ||
} | ||
field(6; "Enum Value Id"; Integer) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Enum Index'; | ||
} | ||
field(7; "Enum Value Caption"; Text[100]) | ||
{ | ||
DataClassification = SystemMetadata; | ||
Caption = 'Enum Caption'; | ||
} | ||
} | ||
|
||
keys | ||
{ | ||
key(Key1; "Language Code", "Table Id", "Field Id", "Enum Value Id") | ||
{ | ||
Clustered = true; | ||
} | ||
} | ||
|
||
procedure InsertEnumLanguage(LanguageCode: Code[10]; TableId: Integer; FieldNo: Integer; FieldName: Text[30]; EnumValueOrdinal: Integer; EnumValueName: Text) | ||
var | ||
ADLSEUtil: Codeunit "ADLSE Util"; | ||
begin | ||
Rec.Init(); | ||
Rec."Language Code" := LanguageCode; | ||
Rec."Table Id" := TableId; | ||
Rec."Compliant Table Name" := CopyStr(ADLSEUtil.GetDataLakeCompliantTableName(TableId), 1, MaxStrLen((Rec."Compliant Table Name"))); | ||
Rec."Field Id" := FieldNo; | ||
Rec."Compliant Field Name" := CopyStr(ADLSEUtil.GetDataLakeCompliantFieldName(FieldName, FieldNo), 1, MaxStrLen((Rec."Compliant Field Name"))); | ||
Rec."Enum Value Id" := EnumValueOrdinal; | ||
Rec."Enum Value Caption" := CopyStr(EnumValueName, 1, MaxStrLen(Rec."Enum Value Caption")); | ||
Rec.Insert(); | ||
end; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
//A list page that is build on table Enum Translation | ||
page 82569 "ADLSE Enum Translations" | ||
{ | ||
PageType = List; | ||
ApplicationArea = All; | ||
UsageCategory = Lists; | ||
SourceTable = "ADLSE Enum Translation"; | ||
|
||
|
||
layout | ||
{ | ||
area(Content) | ||
{ | ||
repeater(GroupName) | ||
{ | ||
field(CompliantTableName; Rec."Compliant Table Name") | ||
{ | ||
Editable = false; | ||
ToolTip = 'The name of the table that is compliant with Data Lake standards.'; | ||
} | ||
field(CompliantFieldName; Rec."Compliant Field Name") | ||
{ | ||
Editable = false; | ||
ToolTip = 'The name of the field that is compliant with Data Lake standards.'; | ||
} | ||
} | ||
} | ||
} | ||
|
||
actions | ||
{ | ||
area(Processing) | ||
{ | ||
action(RefreshOptions) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Refresh Options'; | ||
ToolTip = 'Refresh the options of the enum fields.'; | ||
Image = Refresh; | ||
|
||
trigger OnAction(); | ||
begin | ||
Rec.RefreshOptions(); | ||
end; | ||
} | ||
} | ||
area(Navigation) | ||
{ | ||
action(Translations) | ||
{ | ||
ApplicationArea = All; | ||
Caption = 'Translations'; | ||
ToolTip = 'View the translations of the enum fields.'; | ||
Image = Language; | ||
|
||
trigger OnAction(); | ||
var | ||
ADLSEEnumTranslationLang: Record "ADLSE Enum Translation Lang"; | ||
ADLSEEnumTranslationsLang: Page "ADLSE Enum Translations Lang"; | ||
begin | ||
ADLSEEnumTranslationLang.SetRange("Table Id", Rec."Table Id"); | ||
ADLSEEnumTranslationLang.SetRange("Field Id", Rec."Field Id"); | ||
ADLSEEnumTranslationsLang.SetSelectionFilter(ADLSEEnumTranslationLang); | ||
ADLSEEnumTranslationsLang.RunModal(); | ||
end; | ||
} | ||
} | ||
area(Promoted) | ||
{ | ||
group(Category_Process) | ||
{ | ||
Caption = 'Process'; | ||
actionref(RefreshOptions_Promoted; RefreshOptions) { } | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//A list page that is build on table Enum Translation | ||
page 82570 "ADLSE Enum Translations Lang" | ||
{ | ||
PageType = List; | ||
ApplicationArea = All; | ||
UsageCategory = Lists; | ||
SourceTable = "ADLSE Enum Translation Lang"; | ||
|
||
|
||
layout | ||
{ | ||
area(Content) | ||
{ | ||
repeater(GroupName) | ||
{ | ||
field(LanguageCode; Rec."Language Code") | ||
{ | ||
Editable = false; | ||
ToolTip = 'The language code.'; | ||
} | ||
field(CompliantTableName; Rec."Compliant Table Name") | ||
{ | ||
Editable = false; | ||
ToolTip = 'The name of the table that is compliant with Data Lake standards.'; | ||
} | ||
field(CompliantFieldName; Rec."Compliant Field Name") | ||
{ | ||
Editable = false; | ||
ToolTip = 'The name of the field that is compliant with Data Lake standards.'; | ||
} | ||
field(EnumValueCaption; Rec."Enum Value Caption") | ||
{ | ||
Editable = false; | ||
ToolTip = 'The caption of the enum value.'; | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.