Skip to main content

Notifications

Microsoft Dynamics AX forum
Suggested answer

How to convert str to table name

Posted on by 136
Hi Team,
 
Str tableName = 'CustTable'
In string i am having the table name CustTable and in custTable i am having one 'Test' field, i would like to check that 'Test' field is present in CustTable or not.
 
Please let me know how to achieve this.
 
 
Thanks,
  • Martin Dráb Profile Picture
    Martin Dráb 229,129 Most Valuable Professional on at
    How to convert str to table name
    Please don't change the topic; create a new thread for the other requirement.
     
    Regarding the check whether the table has the Test field or not, is your question answered. If so, please verify the answer. If not, please tell us what doesn't work for you.
  • CU21091228-0 Profile Picture
    CU21091228-0 136 on at
    How to convert str to table name
    Thanks for your reply,
     
    Here Test is a Enum value which store No::Yes elements, i would like to check total how many records are with Yes and total records with No.  
  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 229,129 Most Valuable Professional on at
    How to convert str to table name
    Use can usie fieldName2Id(tableName2Id(tableName), 'Test') and check if it returns a non-zero value.
     
    Another option is DictTable.fieldName2Id().

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

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,802 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,129 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,154

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans