Skip to main content
tabishr9473
August 11, 2023
Solved

Use richTextBulletedList with Foreach on CDT

  • August 11, 2023
  • 5 replies
  • 0 views

I want to use richTextBulletedList with Foreach on CDT type item, but Appian is giving incorrect result. Below is the code & image attached.


a!richTextDisplayField(
                label:"Attachment",
                value: a!richTextBulletedList(
                  items: if(
                    rule!CMN_PLATTS_CheckNullOrEmpty(
                      ri!attachments
                    ),
                    cons!CMN_PLATTS_TXT_NOT_AVAILABLE,
                    a!forEach(
                      items: ri!attachments,
                      expression: {
                        a!richTextItem(
                          text: " " & index(fv!item, "documentName", null),
                          link: rule!CMN_PLATTS_SEC_AWS_GetDocumentLink(
                            filePath: index(fv!item, "attachment", null),
                            documentDetails: fv!item
                          ),
                          linkStyle: "STANDALONE"
                        )
                        & char(10)
                      }
                    )
                  )
                ),
                preventWrapping: true()
              )

Best answer by mathieud0001

Remove the extra & char(10) that you are concatenating after.

a!richTextDisplayField(
  label: "Attachment",
  value: a!richTextBulletedList(
    items: if(
      rule!CMN_PLATTS_CheckNullOrEmpty(ri!attachments),
      cons!CMN_PLATTS_TXT_NOT_AVAILABLE,
      a!forEach(
        items: ri!attachments,
        expression: a!richTextItem(
          text: " " & index(fv!item, "documentName", null),
          link: rule!CMN_PLATTS_SEC_AWS_GetDocumentLink(
            filePath: index(fv!item, "attachment", null),
            documentDetails: fv!item
          ),
          linkStyle: "STANDALONE"
        )
      )
    )
  ),
  preventWrapping: true()
)

5 replies

mathieud0001
Brainy
August 11, 2023

What's incorrect about the result? Seems like you're trying to show a bullet list of attachements (documents).

What is the data type of ri!attachments?

tabishr9473
August 11, 2023

It is a CDT which has Keys {"Attachment_ID","documentName","attachment"}, & yes I'm trying to show it in bulleted list but its giving like shown in the image 

mathieud0001
Brainy
August 11, 2023

Try not wrapping richTextItem in curly brackets.