Some like to use the index() function, I prefer to be very explicit about what I'm doing using the property() function, or at times dot notation. For instance, myDataType.id or myDataType.name.
You could do index(mainCDT, mainCDT_id, 0).nestedCDT should…