Data structure for Comments section

I’m struggling with using external REST API data with this component. I tried assigning values from the Data Variable to the pre-defined fields of the component but that is for some reason not working.

Do I have to use exactly the same data structure (in my database) than the component is using or is there something else that is causing the problem?

Thanks.

Hi!

When using the comments section, the data structure has to be exactly the same for it to work, so you’ll need to bind a list with exactly four properties with the same datatypes to the Comment list property. It is unlikely that anyone’s data resources is exactly identical, so you can use a formula and MAP to transform your data to fit with the Comments list required data like this:

MAP(data.YourCommentData, {id: item.id, content: item.yourdatacomment, username: item.yourdatausername, creationDate: item.yourdatacreationdate}

the data.___ and item.___ are dependent on how you have named your data variable and the properties in your resource.