Skip to content

Commit

Permalink
Adds Environment column to exported data
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRuud authored and y0m0 committed Mar 20, 2024
1 parent 4cccee1 commit e5a63cb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions businessCentral/app/src/CDMUtil.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ codeunit 82566 "ADLSE CDM Util" // Refer Common Data Model https://docs.microsof
var
BlankArray: JsonArray;
CompanyFieldNameLbl: Label '$Company';
EnvironmentFieldNameLbl: Label '$Environment'; //lagt til av Thomas
ExistingFieldCannotBeRemovedErr: Label 'The field %1 in the entity %2 is already present in the data lake and cannot be removed.', Comment = '%1: field name, %2: entity name';
FieldDataTypeCannotBeChangedErr: Label 'The data type for the field %1 in the entity %2 cannot be changed.', Comment = '%1: field name, %2: entity name';
RepresentsTableTxt: Label 'Represents the table %1', Comment = '%1: table caption';
Expand Down Expand Up @@ -136,6 +137,20 @@ codeunit 82566 "ADLSE CDM Util" // Refer Common Data Model https://docs.microsof
Result.Add(
CreateAttributeJson(GetCompanyFieldName(), DataFormat, GetCompanyFieldName(), AppliedTraits, FieldRef.Length));
end;

GetCDMAttributeDetails(FieldType::Text, DataFormat, AppliedTraits);
Result.Add(
CreateAttributeJson(
GetEnvironmentFieldName(),
DataFormat,
GetEnvironmentFieldName(),
AppliedTraits,
FieldRef.Length));
end;

procedure GetEnvironmentFieldName(): Text //lagt til av Thomas
begin
exit(EnvironmentFieldNameLbl);
end;

procedure GetCompanyFieldName(): Text
Expand Down
12 changes: 12 additions & 0 deletions businessCentral/app/src/Util.Codeunit.al
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,12 @@ codeunit 82564 "ADLSE Util"
end;
if IsTablePerCompany(RecordRef.Number) then
Payload.Append(StrSubstNo(CommaPrefixedTok, ADLSECDMUtil.GetCompanyFieldName()));

Payload.Append(StrSubstNo(CommaPrefixedTok, ADLSECDMUtil.GetEnvironmentFieldName())); //lagt til av Thomas

Payload.AppendLine();
RecordPayload := Payload.ToText();

end;

procedure CreateCsvPayload(RecordRef: RecordRef; FieldIdList: List of [Integer]; AddHeaders: Boolean) RecordPayload: Text
Expand All @@ -361,11 +365,19 @@ codeunit 82564 "ADLSE Util"
end;
if IsTablePerCompany(RecordRef.Number) then
Payload.Append(StrSubstNo(CommaPrefixedTok, ConvertStringToText(CompanyName())));
Payload.Append(StrSubstNo(CommaPrefixedTok, ConvertStringToText(EnvironmentName()))); //lagt til av Thomas
Payload.AppendLine();

RecordPayload := Payload.ToText();
end;

procedure EnvironmentName(): Text //lagt til av Thomas
var
EnvironmentInformation: Codeunit "Environment Information";
begin
exit(EnvironmentInformation.GetEnvironmentName());
end;

procedure IsTablePerCompany(TableID: Integer): Boolean
var
TableMetadata: Record "Table Metadata";
Expand Down

0 comments on commit e5a63cb

Please sign in to comment.