We are currently performing maintenance on Appian Community. As a result, discussions posts and replies are temporarily unavailable. We appreciate your patience.

list must be used within a SAIL component

Hi,

We have a three records . Record A has one to many relationship with Record B and Record B has one to many relationship with Record C

We are displaying the all three record data in a grid.

We are having issue when display Record C data if one of the row has no value for Record C.

Here is the snapshot of the grid column. We would like to show each lineItem as numbered list. In this example P2P is top level record.

a!gridColumn(
  label: "Tracker Entry Date",
  value: if(
    a!isNullOrEmpty(fv!row[P2P.invoice.lineItem.name]),
    "",
    a!richTextDisplayField(
      value: a!richTextNumberedList(
        items: fv!row[P2P.invoice.lineItem.name]
      )
    )
  )
),

This works fine in the design mode in the Appian designer. When we access this from the site it throws an error.

"Text?list must be used within a SAIL component"

We don't want to use for each to iterate over each item to check null as it is causing performance problem.

This issue occurs when an invoice does not have  a line Item. How to handle this error?

One solution, I would think to add a dummy row for line Item if the invoice does not contain an line Item.

Is there a better solution? 

Thanks for your help.

Regards,

Surjit

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Could it be that there are multiple lineItems with all names empty? Putting multiple values in an if() condition results in a list of results. Did you try to use null instead of an empty string for the if-true value?

  • Thanks Stefan, I tried with null as well. It raised the same issue. I think if one of the item from the list is null it raises that error. 

    Data with something like below gives the error

    For the 2nd record and 2nd invoice has no line items in this case. If I remove the 2nd invoice or add a line item to 2nd invoice it works.

    Regards,

    SG

  • 0
    Certified Lead Developer
    in reply to surjitg

    This isn't necessarily a fix but I think it could possibly help to handle the list text a little more explicitly - i.e. inside the numbered list component, iterate over the items and display them one by one.  Also, there should be no need for the if() statement doing null-checking; the rich text display field and its in-built showWhen parameter(s) should handle this.  Can you try this alternative?

    a!gridColumn(
      label: "Tracker Entry Date",
      value: a!richTextDisplayField(
        value: a!richTextItem(
          text: {
            a!richTextNumberedList(
              showWhen: a!isNotNullOrEmpty(fv!row[P2P.invoice.lineItem.name]),
              items: a!forEach(
                fv!row[P2P.invoice.lineItem.name],
                a!richTextListItem(
                  text: if(a!isNullOrEmpty(fv!item), "[blank]", fv!item)
                )
              )
            ),
            a!richTextItem(
              showWhen: a!isNullOrEmpty(fv!row[P2P.invoice.lineItem.name]),
              text: "(none)",
              color: "SECONDARY",
              style: "EMPHASIS"
            )
          }
        )
      )
    ),

Reply
  • 0
    Certified Lead Developer
    in reply to surjitg

    This isn't necessarily a fix but I think it could possibly help to handle the list text a little more explicitly - i.e. inside the numbered list component, iterate over the items and display them one by one.  Also, there should be no need for the if() statement doing null-checking; the rich text display field and its in-built showWhen parameter(s) should handle this.  Can you try this alternative?

    a!gridColumn(
      label: "Tracker Entry Date",
      value: a!richTextDisplayField(
        value: a!richTextItem(
          text: {
            a!richTextNumberedList(
              showWhen: a!isNotNullOrEmpty(fv!row[P2P.invoice.lineItem.name]),
              items: a!forEach(
                fv!row[P2P.invoice.lineItem.name],
                a!richTextListItem(
                  text: if(a!isNullOrEmpty(fv!item), "[blank]", fv!item)
                )
              )
            ),
            a!richTextItem(
              showWhen: a!isNullOrEmpty(fv!row[P2P.invoice.lineItem.name]),
              text: "(none)",
              color: "SECONDARY",
              style: "EMPHASIS"
            )
          }
        )
      )
    ),

Children