Skip to main content
Inspiring
Apr 20, 2021 12:37 PM UTC
Solved

Refresh issue with a!richTextItem on variable refresh

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"
))
}
)

mihait203
mihait203Answer
New Participant
Apr 20, 2021 1:56 PM UTC

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}
              )
            )
          )
        }
      )
    }
  )
)

10 replies

peter.lewis
Employee
Apr 20, 2021 1:17 PM UTC

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?

Inspiring
Apr 20, 2021 2:35 PM UTC

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..

peter.lewis
Employee
Apr 20, 2021 4:08 PM UTC

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?

mihait203
mihait203Answer
New Participant
Apr 20, 2021 1:56 PM UTC

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}
              )
            )
          )
        }
      )
    }
  )
)

Inspiring
Apr 20, 2021 2:37 PM UTC

Hi Mihai,

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