Refresh issue with a!richTextItem on variable refresh

Certified Associate Developer

Hi,

richTextItem not reevaluate once surveyDoc variable changes, can anyone help me




a!richTextDisplayField(
label: "",
labelPosition: "COLLAPSED",
value: {
a!richTextItem(
text: {index(local!languageData,"survey",{})},
style: "STRONG"
),
" : ",
if(count(local!surveyDoc)>0,
a!forEach(
items: local!surveyDoc,
expression: {
a!richTextItem(
text:document(tointeger(fv!item.appianDocumentId),"name")& char(13),
link:
if(rule!APN_isBlank(fv!item),
null,
if(rule!TCA_isFileTypeSupportedInDocumentViewer(fileType:document(tointeger(fv!item.appianDocumentId),"extension")),
a!startProcessLink(
processModel: cons!TCA_PM_DOCUMENT_VIEWER,
processParameters: {
documentId: fv!item.documentId,
appiandocid:fv!item.appianDocumentId
}
)

,
a!documentDownloadLink(
label: document(tointeger(fv!item.appianDocumentId),"name"),
document: fv!item.appianDocumentId
)
))

)
}
),a!richTextItem(
text:"Not Available"
))
}
)

  Discussion posts and replies are publicly visible

  • I'm not sure I understand the issue you're having - can you provide more information? What are you expecting to happen and what are you actually seeing happen? What else is happening on your interface?

  • Hi,
    bellow an example how you can append new item into your surveyDoc array and the rich text field will update:

    a!localVariables(
      local!languageData:{survey:"some language"},
      local!surveyDoc:{appianDocumentId:101457},
      a!formLayout(
        label:"Dummy",
        contents:{
          a!richTextDisplayField(
            label: "",
            labelPosition: "COLLAPSED",
            value: {
              a!richTextItem(
                text: { index(local!languageData, "survey", {}) },
                style: "STRONG"
              ),
              " : ",
              if(
                count(local!surveyDoc) > 0,
                a!forEach(
                  items: local!surveyDoc,
                  expression: {
                    a!richTextItem(
                      text: document(
                        tointeger(fv!item.appianDocumentId),
                        "name"
                      ) & char(13),
                      link: if(
                        rule!APN_isBlank(fv!item),
                        null,
                        if(
                          true,
                          a!startProcessLink(
                            processModel: cons!PROCESS_MODEL,
                            processParameters: {
                              documentId: fv!item.documentId,
                              appiandocid:fv!item.appianDocumentId
                            }
                          ),
                          a!documentDownloadLink(
                            label: document(tointeger(fv!item.appianDocumentId),"name"),
                            document: fv!item.appianDocumentId
                          )
                        )
                      )
                    )
                  }
                ),
                a!richTextItem(text: "Not Available")
              )
            }
          ),
          a!buttonLayout(
            secondaryButtons: {
              a!buttonWidget(
                label:"Update survey doc array",
                value:null,
                saveInto:a!save(
                  local!surveyDoc,
                  fn!append(
                    {local!surveyDoc},
                    {appianDocumentId:119534}
                  )
                )
              )
            }
          )
        }
      )
    )

  • 0
    Certified Associate Developer
    in reply to Peter Lewis

    Hi Peter,

    Thanks for the reply, I just want to update/refersh local!surveyDoc on a a!processStart, local!surveyDoc i am using to dynamically display some document names on richTextItem inside richtextdisplayfield..

  • 0
    Certified Associate Developer
    in reply to Mihai-Octavian Tudose

    Hi Mihai,

    Thanks for your reply, I just want to update/refersh local!surveyDoc on a a!processStart wich is a dynamicLink.

  • 0
    Appian Employee
    in reply to Shahid

    I think part of my confusion is that there is nothing in your code above that is updating local!surveyDoc - how is that variable being defined and how do you expect it to be updated? Also, what is the process start link doing?

  • 0
    Certified Associate Developer
    in reply to Peter Lewis

    process start :

    a!linkField(
    label: "",
    labelPosition: "ADJACENT",
    links: {
    a!dynamicLink(
    label: "Pull From Maestro",
    saveInto: {
    a!startProcess(
    processModel: cons!TCA_PM_PULL_DOCS_FROM_MAESTRO,
    processParameters: {
    colocationRequestId:ri!requestId,
    documentTypeId:cons!TCA_VAL_SURVEY_COLOCATION_DOC_ID,
    maestroDocumentId:cons!TCA_VAL_SURVEY_MAESTRO_DOC,
    siteId:local!colocationRequest.siteId
    }
    )
    }
    )
    }
    )

    surveyDoc variable:

    local!surveyDoc:
    rule!TCA_QueryEntity(
    dse:if(rule!APN_isBlank(ri!PIPPackage.packageId),cons!TCA_DSE_VW_GET_REQUEST_DOCUMENTS,cons!TCA_DSE_PIP_PACKAGE_DOCUMENTS) ,
    columns: {"appianDocumentId","documentId"},
    filterEqualFields:if(rule!APN_isBlank(ri!PIPPackage.packageId),{"requestId","documentType"},{"packageId","documentTypeId"}),
    filterEqualValues:if(rule!APN_isBlank(ri!PIPPackage.packageId),{ri!requestId, cons!TCA_VAL_SURVEY_COLOCATION_DOC_ID},{ri!PIPPackage.packageId,cons!TCA_VAL_SURVEY_COLOCATION_DOC_ID}),
    ignoreIsDeleted: false(),
    pagingInfo:a!pagingInfo(1,-1),
    isIndexIntoData:true()
    )

  • +1
    Appian Employee
    in reply to Shahid

    I think the issue is that you need to pull something back from the process after you start it. You currently don't have any way of forcing the local!surveyDoc to refresh after the process completes (and I assume the process is generating a document that you wish to query?)

    I'd suggest adding an "onSuccess" parameter to your start process above that saves the result of the process into another variable. Then, your local!surveyDoc can also check that variable to determine if it needs to refresh using a!refreshVariable().

  • 0
    Certified Lead Developer
    in reply to Shahid

    Hi,

    Just as a side note, code like this would present much more cleanly and readable if you'd insert it into a Code Box - check Mihai's comment (below) for an example.  Like this, it's really hard to read, since all indentation etc has been stripped away.

  • 0
    Certified Associate Developer
    in reply to Peter Lewis

    thanks issue resolved

  • 0
    Certified Associate Developer
    in reply to Mike Schmitt

    thanks i'll remember it next time.