Category: Appsmith Support
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Table - Can’t Access Nested Object

Issue

I am trying to display comments from a feedback column in a table. I have tried different code formats, but none of them seem to work. However, after sharing the app with the support team, I was informed that some entries do not have a comments property. By using optional chaining in my code, I was able to display the comments successfully. I realize I need to learn Javascript more thoroughly.

Resolution

The user was trying to display comments in a cell from a table column named feedback, but was encountering difficulties. They tried different syntaxes like {{currentRow.feedback[0].comments}}, but the evaluated data was good up until the comments. Upon reviewing the app, the issue was identified as some of the feedback entries not having a comments property. The solution was to use optional chaining in the syntax like this: {{currentRow.feedback[0]?.comments}}. This allowed the app to display the comments property if it existed, otherwise, it would skip it and move onto the next property. The user thanked the support team and acknowledged the need to learn Javascript.