I would like to check if there is a way to get the index number of a certain comment. I'm trying to use the iterateandprint function to print all the comments in DESC fashion. However, I also want to print the index number of a certain comment to use as an Update #.
This is what I used:
updatedDetails2=[entry.updatedDetails.sort(timestamp DESC).iterateAndPrint(<strong>Update [entry.content.asLength] - [entry.timestamp.formatDate]:</strong> [entry.content]<br><br>).renderAsHtml]
I'm trying to replace this [entry.content.asLength] to the index # of the comment. I have not found anything that works yet since Length counts the length of the text of the content and not the index #.
This one works [entry.updatedDetails.asLength] but only outside the iterateandprint function so it only returns the number of comments. e.g. 3 if there are currently 3 comments.
I'm trying to display all Updates in a comment so it prints like this:
Update 3 - Feb 15, 2023 02:46: Text
Update 2 - Feb 16, 2023 22:44: Text
Update 1 - Feb 16, 2023 22:42: Text
So the the sequence in the Update number is what I'm trying to retrieve via the index # of the comment field. So far I have not found any Virtual function in confiform that will help me retrieve the Index number of the comment.
I hope my question makes sense.
Hi @jenni
Your question does make sense, but this is currently not possible in ConfiForms
It does not keep the index of the element it prints out in the context for your to access
Alex
Thanks for the response @Alex Medved _ConfiForms_. Would you have any suggestion on how I can probably get to print a series of numbers inside the IterateandPrint function for the Comment field to be able to display something like this?
Update 3 - Feb 15, 2023 02:46: Text
Update 2 - Feb 16, 2023 22:44: Text
Update 1 - Feb 16, 2023 22:42: Text
This already displays the format I want except for the number after the update.
updatedDetails2=[entry.updatedDetails.sort(timestamp DESC).iterateAndPrint(<strong>Update [entry.content.asLength] - [entry.timestamp.formatDate]:</strong> [entry.content]<br><br>).renderAsHtml]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Index is not maintained when iterateAndPrint is applied.
So, there is nowhere to take it. Sorry
BTW, why do you need to copy data as you have and not using it directly?
I mean you can just have the full expression like that in the ConfiForms Field macro (field name parameter)
updatedDetails.sort(timestamp DESC).iterateAndPrint(<strong>Update [entry.content.asLength] - [entry.timestamp.formatDate]:</strong> [entry.content]<br><br>).renderAsHtml
It will be transformed for you realtime from the original field
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.