Import new column into G/L Budget Entry

CobaltSSCobaltSS Member Posts: 137
Hi all,

I've been asked to add a Description to the Excel sheet that gets imported via the Budget -> Import From Excel function that can change line by line. So I've made a few mods.
    In table 371 Budget Buffer I've added the field "Description" (text 50). In report 81, I've added the Text constant "CN_Text001" and assigned it "Description" In the Analyze Data function of Report 81, I've added the following code (I've included existing code so you can see where it was placed):
              Text022:
                TempBudgetBuf."Dimension Value Code 8" :=
                  COPYSTR(
                    ExcelBuf."Cell Value as Text",
                    1,MAXSTRLEN(TempBudgetBuf."Dimension Value Code 8"));
// >> CN1.78
              CN_Text001:
                BEGIN
                  booOK := CONFIRM('Description: %1', booOK,  ExcelBuf."Cell Value as Text");
                  TempBudgetBuf.Description :=
                    COPYSTR(
                      ExcelBuf."Cell Value as Text",
                      1,MAXSTRLEN(TempBudgetBuf.Description));
                END;
// << CN1.78
              Text014:
                BEGIN
                  IF TempBudgetBuf."G/L Account No." <> '' THEN BEGIN

In the OnAfterGetRecord of BudgetBuf, I've made this mod:
// >> CN1.78
// original - GLBudgetEntry.Description := Description;
GLBudgetEntry.Description := BudgetBuf.Description;
// << CN1.78

When I disable the Excel Buffer DELETEALL, I reviewed the data and it appears to be stored in the Excel Buffer table properly:


But the G/L Budget Description remains blank. And I don't get any CONFIRM dialogue. In the Excel spreadsheet, the column is called "Description".

Any advice greatly appreciated.

cheers,

Answers

  • CobaltSSCobaltSS Member Posts: 137
    I needed to add one more bit of code into the Analyze Data function, as the "header row" checks only look for the G/L Account No, Dimensions, and valid dates (related to the period) (look for the tags - excess code given to show placement):
          ExcelBuf."Row No." = HeaderRowNo:
            BEGIN
              TempExcelBuf := ExcelBuf;
              CASE TRUE OF
                TempDim.FIND('-'):
                  BEGIN
                    TempDim.MARK(FALSE);
                    CountDim := CountDim + 1;
                    IF (CountDim > 8) THEN
                      ERROR(Text008);
                    TempExcelBuf.Comment := Text013 + FORMAT(CountDim);
                    TempExcelBuf.INSERT;
                    DimCode[CountDim] := TempDim.Code;
                  END;
                EVALUATE(TestDate,ExcelBuf."Cell Value as Text"):
                  BEGIN
                    TempExcelBuf.Comment := Text014;
                    TempExcelBuf.INSERT;
                  END;
    // >> CN1.78
                ExcelBuf."Cell Value as Text" = CN_Text001:
                  BEGIN
                    TempExcelBuf.Comment := CN_Text001;
                    TempExcelBuf.INSERT;
                  END;
    // << CN1.78
    
              END;
            END;
    
          (ExcelBuf."Row No." > HeaderRowNo) AND (HeaderRowNo > 0):
    

    I hope this proves useful to someone else.

    cheers,
Sign In or Register to comment.