Options

Get Record Field value by Field Name

InregoInrego Member Posts: 9
edited 2015-09-24 in NAV Three Tier
Hey there. I'm trying to dynamically retrieve a field value from a record. Lets say for example I have the field name 'Phone No.' stored as a string in a variable. How can I use this string to get the value of the field with that name from a record?

For example, in C# I would use reflection - but I've no idea how to do it in C/SIDE

Comments

  • Options
    Jan_VeenendaalJan_Veenendaal Member Posts: 206
    Hi,

    You can use the datatypes RecordRef and FieldRef for this.

    A RecordRef has a member FIELDCOUNT. Also there is a member called FIELDINDEX that will, based on an index (from 1..FIELDCOUNT), return a FieldRef

    A FieldRef has a NAME property that you can check against your variable content.
    When you've found the field, you can access the VALUE of that FieldRef (You may need to check the TYPE ;) )
    Jan Veenendaal
  • Options
    InregoInrego Member Posts: 9
    Thank you! I found an article that goes in depth with this method.
    For reference to other users coming here: http://www.archerpoint.com/blog/Posts/j ... namics-nav
Sign In or Register to comment.