Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

how to get field Name from fieldNum?

(0) ShareShare
ReportReport
Posted on by 920

Hello,

I have this tabel that contains TableNum and fienNum :  

pastedimage1683540397142v1.png

I want to get the field Name But I don't which table that contains the fieldId and the fieldName

Have you any idea how to get the field name?

Thanks

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: how to get field Name from fieldNum?

    You can use the Find labels from extensions and then paste the table label and give a find reference on that. It will give the field name.

    Another way is to navigate to that tablenum means you can get table name and then you can search the fields with that labels.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to get field Name from fieldNum?

    inventTable contains many fields ,

    I see it's not practical to go through all the fields one by one to check

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to get field Name from fieldNum?

    Then there is no way you need to check each of the field from the InventTable and add select statement based on that.

     while select mandatoryFieldsTable where mandatoryFieldsTable.StateId == productLifeCycleState.StateId
            {
                switch(mandatoryFieldsTable.TableNum)
                {
                    case tableNum(InventTable):
                        DictTable       dictTable;
                        DictField       dictField;
                        int             i, cnt;
                        InventTable  inventFieldTable;
                         dictTable = new DictTable(tableNum(InventTable));
                         cnt = dictTable.fieldCnt();
                         for (i= 1; i<=cnt;i  )
                         {
                            dictField = new DictField(tableNum(InventTable),dictTable.fieldCnt2Id(i));
                            if(dictField.label() == mandatoryFieldsTable.FieldLabel))
                            {
                                fieldName = fieldId2Name(mandatoryFieldsTable.TableNum,dictField.Id());
                            }
                         }
                         if(fieldName == "ABCTieUp)
                         {
                            if(invnetFieldTable.ABCTieUp != 0)
                            {
                            }
                         }
                         //smilarly for all the fields you need to write.
                         if(fieldName == "Field2")
                         {
                            if(invnentFieldTable.Field2 != 0_
                            {
                            }
                         }
                        
                    break;
                    case tableNum(InventModelGroupItem):
                        InventModelGroupItem inventModelGroupItem;
    
                    break;
                    case tableNum(EcoResStorageDimensionGroupItem):
                        EcoResStorageDimensionGroupItem storageDimensionGroupItem;
    
                    break;
                    case tableNum(EcoResTrackingDimensionGroupItem):
                        EcoResTrackingDimensionGroupItem trackingDimensionGroupItem;
                }
            }

    Thanks,

    Girish S,

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to get field Name from fieldNum?

    I debug the code, I get only the name of field :  

    pastedimage1683560693139v1.png

    I want to check if this field is empty or no like this : 

    pastedimage1683560752225v2.png

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to get field Name from fieldNum?

    Yes, try the code i have given in my previous reply and let us know if it meets your scenario. 

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to get field Name from fieldNum?

    ok, 

    for example  I select this field  : 

    pastedimage1683559431201v1.png

    I want to serach in inventTable if this  field is filled or not I means that I find a value in the field"ABC-Code Carring Cost" 

    ...

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to get field Name from fieldNum?

    What do you mean by field found in invent Table is empty or not?

    Can you elaborate?

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to get field Name from fieldNum?

    yes I understand this part,

    But I want to check if this field found in inventTable is empty or no

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: how to get field Name from fieldNum?

    Code I have given will loop through all the fields in the InventTable and compare with fields given in your custom table which is MandatoryFieldTable.

    So, the DictTable used DictField to loop through all the field in the InventTable.

    Thanks,

    Girish S.

  • BASMA Profile Picture
    BASMA 920 on at
    RE: how to get field Name from fieldNum?

    you probably don't understand me,

    I search if the field in the table inventTable has a value or empty

    not if the table has this field or no

    I want to add select from inventTable where this field != null

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans