Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Get Column Name of Microsoft Excel

Posted on by 910

Hello,

I try to import an excel file to ax so i can get  the value of specific column using this : 

SysExcelCells.item(rowIdx, columnIndex).value()

Is there anyway to get the Column Name  ?

*This post is locked for comments

  • ALAhmed Profile Picture
    ALAhmed 910 on at
    RE: Get Column Name of Microsoft Excel

    Hello ,

    IT's ok i 'm using this :

    if(sauParmCopyPasteLines.FieldId == fieldNum(LedgerJournalTrans, AmountCurDebit)

    || sauParmCopyPasteLines.FieldId == fieldNum(LedgerJournalTrans, AmountCurCredit) )

    instead of  if(columnIndex == 6 || columnIndex == 7)

  • ALAhmed Profile Picture
    ALAhmed 910 on at
    RE: Get Column Name of Microsoft Excel

    Hi André,

    I'm using the custom code and i search the field name of the first row.

    I’ll explain my problem , the list of column name is setting in one form and when I import the file  I have in this file two column with Amount value.(like 423.42 & 4567.66). In Excel when we change the point by comma in the value of amount ,after the import we get only for (423,42 & 4567,66) => .( 423 & 4567). Without the decimal value.This is coming when we use this function

    Cellstr = this.COMVariant2Str(cells.item(rowIdx, columnIndex).value());

    // convert into str from excel cell value

    str comVariant2Str(COMVariant _cv, int _decimals = 0, int _characters = 0, int _separator1 = 0, int _separator2 = 0)

    {

    }

    Here by default I have decimals = 0 but I want change this decimals to 2 for only two column.

    Actualy I’m do that and it’s work but what if the order of field change in the parmeter form..

    if(columnIndex == 6 || columnIndex == 7)

    {

      Cellstr = num2str(cells.item(rowIdx, columnIndex).value().double(),0,2,0,0);

    }

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,219 Super User 2024 Season 2 on at
    RE: Get Column Name of Microsoft Excel

    Hi Alex,

    What technology are you using to import the excel file? Data Import Export Framework or custom coding? What is the purpose of getting the Column name? Are you searching for 'A','B','C' etc or the field name on the first row?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,219 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans