Skip to main content
sowmyak2554
April 2, 2024
Question

Please explain how we can use index function with cdt? want explanation with example.

  • April 2, 2024
  • 3 replies
  • 0 views

Hi Team,

I understood how index function works, but can someone please write a code(with example) using index function with cdt.

3 replies

konduruc733182
April 2, 2024

Hello [mention:777c883886684872a83b0b712bb7e036:e9ed411860ed4f2ba0265705b8793d05] 

Please refer the below documentation

index()

Interface Recipes : Set the value of a CDT field based on a user input

kalpeshg0081
April 2, 2024

Hi [mention:777c883886684872a83b0b712bb7e036:e9ed411860ed4f2ba0265705b8793d05] ,

Lets assume you have 3 column in a CDT EmployeeData as "Name", "Number", "City". now if you want to fetch all the values of City column, you need to use the index function as below:

Index(Your_CDT,column_Name,default_Value)

Index(EmployeeData, "City", null)

And in case of Record type, code syntax will be same. but you can not index it directly by giving the column name, you need to pass the column name as below

Index(EmployeeData, recordType!yourRecordName.fields.yourField, null)

mikes0011
Brainy
April 2, 2024

For readability I continue to recommend people use "property()" when attempting to get a dot property, and reserve "index()" for finding the index (position) of an array.  The two functions are interchangeable but that doesn't mean readability isn't muddled when one is overused.