How do I strip all html <tags>

We currently have a process where users enter comments in rich text format into a portal form. We save this in Appian PVs and also write the comments to an SQL table.

We are slowly moving to Tempo and have built a tempo form that displays all the comments in a grid (values retrieved from the SQL table using a query rule). But the problem is that we see all of the HTML tags displayed. Is there a way to display the comments in rich text format? or as last resort some way to remove all the HTML tags?

thanks

thanks

OriginalPostID-215413

OriginalPostID-215413

  Discussion posts and replies are publicly visible

  • Hello Brandon, You can use striphtml function to remove all HTML Tags. Can you share the sample of data you are receiving from DB.
  • @Brandon.B Hi, to the best of my knowledge, there isn't really a direct way to display the HTML content in the SAIL interfaces except when you make use of the Rich Text Field SAIL component and for this you need to follow a specific format wherein you may need to use some functions to achieve the desired formatting.

    As far as my knowledge is considered, following could be some of various options available:

    1. If you are making use of Paging Grid, then I believe that escaping the HTML tags is the only option. I believe you can make use of fn!striphtml() here. I am unsure about the line breaks (which is equivalent to
    in HTML) here, but I am sure that you the Paging Grid wouldn't be able to support the formatting such as bold, italics, links etc.

    2. If you are okay with using a Editable Grid, then you may use the Rich Text Field SAIL component and can display the HTML content to most extent. But this needs some pre-processing as per my knowledge, that is, we should turn the contents present in a particular column in the database entity into such a format that it's understandable by Rich Text Field SAIL component so that it can render the content in the desired format. If you want to opt for this, following is what you should do:

    a. Make use of the plugin 'RichText Tools' (present at https://forum.appian.com/suite/tempo/records/item/lMBCLGOdlMUpdGVqW3dQaIKmclBmvvNEj8vu_cjb7T-5YiPr4Fu8ly5Yj1s09uenE4RYzA8zKyx7eiUhuOvLnO1u7sKzsIUxxf9kBWuLblcmwcuDw/view/summary) and make sure that the HTML tags are replaced with the contents which represent a format as per the plugin. Here we are converting the HTML content into a format in such a way that it's readable by Rich Text Display Field SAIL component.

    Example: I am italicised. should be represented as *I am italicised.*

    b. The output of the above contents should be fed to Rich Text Display Field SAIL component later when you are making use of the Editable Grid.

    But we need to bear following few points in the mind:
    * Rich Text Display Field SAIL Component is version dependent.
    * Performance goes down when the contents (Number of rows/columns) in the Editable Grid are many.
    * Rich Text Display Field SAIL Component is also very costly in terms of performance.
    * Converting the HMTL tags into Mark up language might be a time consuming activity.
    * We miss Paging and Sorting in Editable Grid. Still we can apply Pagination to the Editable Grid by building a set of expression rules, but again this might be a time consuming activity.

    3. An other good option is to get the formatted content on demand which wouldn't cause any performance issues. In the Paging Grid, add a column which contains an icon/text and when it is clicked, surface the contents in a Rich Text Display Field Component (may be, below the Paging Grid) separately by following the procedure (with regards to formatting the contents using Mark Up language) as specified in option 2.

    In your question, you said that you are making use of Tempo Forms. If the form is designed by making use of Forms Designer and is Tempo Enabled, then option 2 doesn't apply.

    Finally you may also want to think about the way to capture the comments going ahead, as now you are making use of Tempo. Afaik there isn't a component in SAIL currently that matches the capability(when it comes to editable mode) offered by Rich Text Field in the Forms Designer. So either you should educate the user to follow a specified markup language (while providing values) in-case if the HTML formatting style is needed or else you may capture the text in an ordinary way (without any formatting) and use fn!striphtml() to remove formatting from the historic data.
  • Hi

    I hope you can help a little more here.

    I am trying to use the fn!striphtml function but cannot get it to work with my query entity expression that I have for my records (shown below)

    Is it even possible to do it as part of this expression, or will I need to manipulate/retrieve the data some other way?

    with(
    local!datasubset: a!queryEntity(
    cons!INS_ENTITY_POLICYNOTESLOG,
    a!query(
    selection: a!querySelection(columns: {
    a!queryColumn(field: "Notes"),
    a!queryColumn(field: "NotesUser"),
    a!queryColumn(field: "NoteType"),
    a!queryColumn(field: "DateTimeStamp"),
    }),
    filter: a!queryFilter(field: "ApplicationNumber", operator: "=", value: ri!ApplicationNumber),
    pagingInfo: local!pagingInfo
    )
    ),
    a!gridField(
    totalCount: local!datasubset.totalCount,
    columns: {
    a!gridTextColumn(
    label: "Note",
    field: "Notes",
    data: index(local!datasubset.data, "Notes", null)
    ),
    a!gridTextColumn(
    label: "Note Type",
    field: "NoteType",
    data: index(local!datasubset.data, "NoteType", null)
    ),
    a!gridTextColumn(
    label: "User",
    field: "NotesUser",
    data: index(local!datasubset.data, "NotesUser", null)
    ),
    a!gridTextColumn(
    label: "Date",
    field: "DateTimeStamp",
    data: index(local!datasubset.data, "DateTimeStamp", null)
    )
    },
    value: local!pagingInfo,
    saveInto: local!pagingInfo
    )
    )


    thanks in advance :)
  • 0
    Certified Lead Developer

    I'm not sure if this is still open, But Appian provides a new function stripHtml to strip all the HTML tags out of the box. This is currently supported from version 20.1