<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/discussions/f/general/23336/approach-to-filter-data-after-fetched-from-stored-procedure</link><description>Want to know best approach to filter data after getting fetched from Stored procedure</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89647?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 14:44:10 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d604ba61-7315-46cb-bcbf-18b6feede12f</guid><dc:creator>Klaus34</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!selectedEntityIdtoRemove,
  local!entityTypeId: cons!TEST_SUBMISSION_DOCUMENTS_ENTITY_TYPE_ID,
  local!questionIds: index(
    index(
      rule!TEST_getQuestionsByCaidAndEntityTypeId(
        contentAreaId: index(
          ri!contentAreaCountryVw,
          &amp;quot;contentAreaId&amp;quot;,
          {}
        ),
        entityTypeId: local!entityTypeId
      ),
      &amp;quot;data&amp;quot;,
      {}
    ),
    &amp;quot;questionId&amp;quot;,
    {}
  ),
  local!questionOptions: if(
    or(
      isnull(local!questionIds),
      count(local!questionIds) = 0
    ),
    {},
    a!flatten(
      rule!TEST_getQuestionOptionsValueByQuestionIdHandleNull(questionId: local!questionIds)
    )
  ),
  local!dd_docTypes: cons!TEST_SUB_DOC_TYPES,
  local!filterDocType,
  local!filterDocName,
  local!CurrentPage,
  local!expandCollapseComments,
  local!datasubset: todatasubset(ri!oldAnswerData, ri!pagingInfo),
  local!selection,
  local!selectedDocument,
  local!removeIds,
  local!entityId: index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {}),
  local!documentData: rule!TEST_getAllRSUSubDocNotInEntityIdseDocType(entityIds: local!entityId),

  local!deleteDocumentIds,

  local!totalDataCount: count(ri!oldAnswerData),

  local!SubDocData: rule!TEST_getAllRSUSubDocEntityIdDefinitionsDocName(),
  local!totalNumberOfDocuments:length(trim(ri!oldAnswerData)),
  {

    if(
      ri!isQCReview,
      {},
      a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            loadingIndicator :true,
            icon:&amp;quot;remove&amp;quot;,
            label: &amp;quot;Remove&amp;quot;,
            saveInto: {
              a!save(
                ri!deletedEntityId,
                append(
                  ri!deletedEntityId,
                  a!forEach(
                    items: ri!selectedIndices,
                    expression: &amp;#39;type!{urn:com:appian:types:TEST}TEST_SubDocs_SPResultset&amp;#39;(
                      entity_ID: fv!item,
                      comments: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;comments&amp;quot;,
                        {}
                      ),
                      translationNeeded: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;translationNeeded&amp;quot;,
                        {}
                      ),
                      lecSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;lecSubmission&amp;quot;,
                        {}
                      ),
                      cecSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;cecSubmission&amp;quot;,
                        {}
                      ),
                      regionalRaSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;regionalRaSubmission&amp;quot;,
                        {}
                      ),
                      countryRaSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;countryRaSubmission&amp;quot;,
                        {}
                      ),
                      importExportLicense: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;importExportLicense&amp;quot;,
                        {}
                      ),
                      contractNegoAndExec: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;contractNegoAndExec&amp;quot;,
                        {}
                      ),
                      requiredForEdp: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;requiredForEdp&amp;quot;,
                        {}
                      ),
                      euCTRPart1: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;euCTRPart1&amp;quot;,
                        {}
                      ),
                      euCTRPart2: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;euCTRPart2&amp;quot;,
                        {}
                      ),

                    )
                  )
                )
              ),
              a!save(
                local!deleteDocumentIds,
                remove(
                  ri!oldAnswerData,
                  wherecontains(
                    ri!selectedIndices,
                    index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                  )
                )
              ),
              a!save(
                ri!oldAnswerData,
                local!deleteDocumentIds
              ),
              a!save(ri!selectedIndices, {}),
              a!save(
                ri!subDocs,
                index(
                  rule!TEST_getQuesEntitiesByIds(
                    tointeger(index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {}))
                  ),
                  &amp;quot;data&amp;quot;,
                  {}
                )
              ),

            },
            disabled: if(
              rule!APN_isEmpty(ri!selectedIndices),
              true,
              false
            )
          )
        }
      )
    ),
    rule!TEST_hyperLinkgridPagination(
      pagingInfo: ri!pagingInfo,

      totalDataCount:local!totalNumberOfDocuments,
      CurrentPage: local!CurrentPage
    ),
    a!gridLayout(
      validations:if(ri!isQCReview,{},a!validationMessage(
        message: &amp;quot;A value is required . Please review and submit the form&amp;quot;,
        validateAfter: &amp;quot;SUBMIT&amp;quot;,
        showWhen: if(
          rule!TEST_validationForRequiredSubgrid(
            input: cons!TEST_SUB_DOC_grid_QUESTION_VALUES,
            oldAnswerData: ri!oldAnswerData
          ),false,true)
      )),


      labelPosition: &amp;quot;COLLAPSED&amp;quot;,
      totalCount: local!totalDataCount,
      headerCells: {
        a!gridLayoutHeaderCell(label: &amp;quot;Doc Type&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Document Name&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Definition&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Comments&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Translation needed?&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Required for LEC submission?&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Required for CEC submission?&amp;quot;),
        a!gridLayoutHeaderCell(
          label: &amp;quot;Required for Regional RA submission?&amp;quot;
        ),
        a!gridLayoutHeaderCell(
          label: &amp;quot;Required for Country RA submission?&amp;quot;
        ),
        a!gridLayoutHeaderCell(label: &amp;quot;Required for Other submission?&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;Import/Export license&amp;quot;),
        /* TEST 2.3 - Update Name &amp;amp; Remove Contract to be executed col*/
        a!gridLayoutHeaderCell(
          label: &amp;quot;Contract negotiation and execution documents&amp;quot;
        ),
        a!gridLayoutHeaderCell(label: &amp;quot;Required for EDP?&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;EU CTR Part 1&amp;quot;),
        a!gridLayoutHeaderCell(label: &amp;quot;EU CTR Part 2&amp;quot;)
      },
      columnConfigs: {
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3),
        a!gridLayoutColumnConfig(width: &amp;quot;DISTRIBUTE&amp;quot;, weight: 3)
      },
      rows: a!forEach(
        items: local!datasubset,
        expression: a!gridRowLayout(
          id: fv!item.entity_ID,
          contents: {
            a!richTextDisplayField(
              value: if(
                ri!isQCReview,
                if(
                  if(
                    rule!APN_isEmpty(ri!rsuDocumentDifference),
                    false,
                    and(
                      contains(ri!rsuDocumentDifference, fv!item)/* not(
                    isnull(
                      ri!oldAnswerData[fv!index].entity_ID
                    )
                  )*/

                    )
                  ),
                  {
                    a!richTextIcon(icon: &amp;quot;ASTERISK&amp;quot;, color: &amp;quot;POSITIVE&amp;quot;),
                    a!richTextIcon(icon: &amp;quot;ASTERISK&amp;quot;, color: &amp;quot;POSITIVE&amp;quot;),
                    a!richTextItem(
                      text: {
                        index(
                          index(
                            local!SubDocData,
                            wherecontains(
                              tointeger(fv!item.entity_ID),
                              tointeger(local!SubDocData.entityId)
                            )
                          ),
                          &amp;quot;eDocType&amp;quot;,
                          {}
                        )
                      }
                    )
                  },
                  a!richTextItem(
                    text: {
                      index(
                        index(
                          local!SubDocData,
                          wherecontains(
                            tointeger(fv!item.entity_ID),
                            tointeger(local!SubDocData.entityId)
                          )
                        ),
                        &amp;quot;eDocType&amp;quot;,
                        {}
                      )
                    }
                  )
                ),
                a!richTextItem(
                  text: {
                    index(
                      index(
                        local!SubDocData,
                        wherecontains(
                          tointeger(fv!item.entity_ID),
                          tointeger(local!SubDocData.entityId)
                        )
                      ),
                      &amp;quot;eDocType&amp;quot;,
                      {}
                    )
                  }
                )
              )
            ),
            a!richTextDisplayField(
              value: index(
                index(
                  local!SubDocData,
                  wherecontains(
                    tointeger(fv!item.entity_ID),
                    tointeger(local!SubDocData.entityId)
                  )
                ),
                &amp;quot;displayName&amp;quot;,
                {}
              )
            ),

            a!richTextDisplayField(
              preventWrapping :true,
              value: index(
                index(
                  local!SubDocData,
                  wherecontains(
                    tointeger(fv!item.entity_ID),
                    tointeger(local!SubDocData.entityId)
                  )
                ),
                &amp;quot;definition&amp;quot;,
                {}
              ))
              ,
              if(
                contains(ri!selectedIndices, fv!item.entity_ID),
                a!textField(
                  value: fv!item.comments,
                  saveInto: {
                    fv!item.comments,
                    a!save(
                      ri!oldAnswerData[wherecontains(
                        fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                      )].comments,
                      save!value
                    )
                  },
                  validations: if(
                    len(fv!item.comments) &amp;gt; 2000,
                    &amp;quot;Limit your Entry to &amp;quot; &amp;amp; 2000 &amp;amp; &amp;quot; characters!&amp;quot;,
                    null
                  )
                ),
                if(
                  tointeger(local!expandCollapseComments) = fv!identifier,
                  a!richTextDisplayField(
                    value: if(
                      len(fv!item.comments) &amp;gt; 25,
                      {
                        a!richTextItem(text: fv!item.comments),
                        a!richTextItem(
                          text: &amp;quot; collapse&amp;quot;,
                          link: a!dynamicLink(
                            label: &amp;quot;&amp;quot;,
                            saveInto: a!save(local!expandCollapseComments, 0)
                          ),
                          linkStyle: &amp;quot;STANDALONE&amp;quot;
                        )
                      },
                      a!richTextItem(text: fv!item.comments, )
                    )
                  ),
                  a!richTextDisplayField(
                    value: if(
                      len(fv!item.comments) &amp;gt; 25,
                      {
                        a!richTextItem(text: left(fv!item.comments, 25)),
                        a!richTextItem(
                          text: &amp;quot; expand&amp;quot;,
                          link: a!dynamicLink(
                            label: &amp;quot;expand&amp;quot;,
                            saveInto: a!save(
                              local!expandCollapseComments,
                              fv!identifier
                            )
                          ),
                          linkStyle: &amp;quot;STANDALONE&amp;quot;
                        )
                      },
                      a!richTextItem(text: fv!item.comments, )
                    )
                  )
                )
              ),
              a!dropdownField(
                required:if(ri!isQCReview, false, true),
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[2],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                )
                ,
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[2],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                )
                ,
                value: upper(fv!item.translationNeeded),
                saveInto: {
                  fv!item.translationNeeded,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].translationNeeded,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[3],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                )
                ,
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[3],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.lecSubmission),
                required:if(ri!isQCReview, false, true),
                saveInto: {
                  fv!item.lecSubmission,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].lecSubmission,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[4],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[4],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                )
                ,
                value: upper(fv!item.cecSubmission),
                saveInto: {
                  fv!item.cecSubmission,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].cecSubmission,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[5],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                )
                ,
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[5],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.regionalRaSubmission),
                saveInto: {
                  fv!item.regionalRaSubmission,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].regionalRaSubmission,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[6],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  )

                ),
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[6],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.countryRaSubmission),
                saveInto: {
                  fv!item.countryRaSubmission,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].countryRaSubmission,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[7],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                )
                ,
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[7],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.otherSubmission),
                saveInto: {
                  fv!item.otherSubmission,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].otherSubmission,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[8],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[8],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.importExportLicense),
                saveInto: {
                  fv!item.importExportLicense,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].importExportLicense,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[9],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                choiceValues:  index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[9],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                ),
                value: upper(fv!item.contractNegoAndExec),
                saveInto: {
                  fv!item.contractNegoAndExec,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].contractNegoAndExec,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[11],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[11],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.requiredForEdp),
                saveInto: {
                  fv!item.requiredForEdp,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].requiredForEdp,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[12],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                choiceValues:  index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[12],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}
                ),
                value: upper(fv!item.euCTRPart1),
                saveInto: {
                  fv!item.euCTRPart1,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].euCTRPart1,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              ),
              a!dropdownField(
                placeholder: &amp;quot;-- Select -- &amp;quot;,
                required:if(ri!isQCReview, false, true),
                choiceLabels: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[13],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                choiceValues: 
                index(
                  index(local!questionOptions, &amp;quot;value&amp;quot;, {}),
                  wherecontains(
                    cons!TEST_SUB_DOC_QUESTION_IDS[13],
                    tointeger(
                      index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})
                    )
                  ),
                  {}

                ),
                value: upper(fv!item.euCTRPart2),
                saveInto: {
                  fv!item.euCTRPart2,
                  a!save(
                    ri!oldAnswerData[wherecontains(
                      fv!item.entity_ID, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                    )].euCTRPart2,
                    save!value
                  )
                },
                disabled: if(
                  contains(ri!selectedIndices, fv!item.entity_ID),
                  false,
                  true
                )
              )
          }
        )
      ),
      selectionValue: ri!selectedIndices,
      selectionSaveInto: a!save(
        ri!selectedIndices,
        a!flatten(save!value)
      ),
      selectable: if(ri!isQCReview, false, true),
      height: &amp;quot;TALL&amp;quot;
    ),
    if(
      ri!isQCReview,
      {},
      a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            loadingIndicator :true,
            icon:&amp;quot;remove&amp;quot;,
            label: &amp;quot;Remove&amp;quot;,
            saveInto: {
              a!save(
                ri!deletedEntityId,
                append(
                  ri!deletedEntityId,
                  a!forEach(
                    items: ri!selectedIndices,
                    expression: &amp;#39;type!{urn:com:appian:types:TEST}TEST_SubDocs_SPResultset&amp;#39;(
                      entity_ID: fv!item,
                      comments: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;comments&amp;quot;,
                        {}
                      ),
                      translationNeeded: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;translationNeeded&amp;quot;,
                        {}
                      ),
                      lecSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;lecSubmission&amp;quot;,
                        {}
                      ),
                      cecSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;cecSubmission&amp;quot;,
                        {}
                      ),
                      regionalRaSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;regionalRaSubmission&amp;quot;,
                        {}
                      ),
                      countryRaSubmission: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;countryRaSubmission&amp;quot;,
                        {}
                      ),
                      importExportLicense: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;importExportLicense&amp;quot;,
                        {}
                      ),
                      contractNegoAndExec: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;contractNegoAndExec&amp;quot;,
                        {}
                      ),
                      requiredForEdp: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;requiredForEdp&amp;quot;,
                        {}
                      ),
                      euCTRPart1: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;euCTRPart1&amp;quot;,
                        {}
                      ),
                      euCTRPart2: index(
                        ri!oldAnswerData[wherecontains(
                          fv!item, index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                        )],
                        &amp;quot;euCTRPart2&amp;quot;,
                        {}
                      )
                    )
                  )
                )
              ),
              a!save(
                local!deleteDocumentIds,
                remove(
                  ri!oldAnswerData,
                  wherecontains(
                    ri!selectedIndices,
                    index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {})
                  )
                )
              ),
              a!save(
                ri!oldAnswerData,
                local!deleteDocumentIds
              ),
              a!save(ri!selectedIndices, {}),
              a!save(
                ri!subDocs,
                index(
                  rule!TEST_getQuesEntitiesByIds(
                    tointeger(index(ri!oldAnswerData, &amp;quot;entity_ID&amp;quot;, {}))
                  ),
                  &amp;quot;data&amp;quot;,
                  {}
                )
              ),

            },
            disabled: if(
              rule!APN_isEmpty(ri!selectedIndices),
              true,
              false
            )
          )
        }
      )
    )})&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;in the editable grid filters of edoctype and Displayname needs to be applied&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89642?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 14:31:21 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:06e710b5-6a3a-47f3-83dc-1e48a7233a62</guid><dc:creator>Stefan Helzle</dc:creator><description>&lt;p&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1641911478442v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89639?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 14:18:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a6b3c2d9-b725-4704-98c3-e38c865b5846</guid><dc:creator>Klaus34</dc:creator><description>&lt;p&gt;Thanks Peter&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89638?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 14:11:40 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:09449539-c43e-45d8-a037-15dfae700870</guid><dc:creator>Peter Lewis</dc:creator><description>&lt;p&gt;Like the other poster said, in general I recommend doing your filtering during your query because the database is much more efficient at filtering than running an expression. That being said, there are some cases where it&amp;#39;s necessary to filter in an expression, so if you have a relatively small dataset then there are two methods I&amp;#39;ve typically used to filter on the fly:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!localVariables(
  local!cases: {
    a!map(
      id: 1,
      priority: &amp;quot;Low&amp;quot;,
      status: &amp;quot;New&amp;quot;,
      dateUpdated: today()
    ),
    a!map(
      id: 2,
      priority: &amp;quot;Medium&amp;quot;,
      status: &amp;quot;Pending Response&amp;quot;,
      dateUpdated: today() - 4
    ),
    a!map(
      id: 3,
      priority: &amp;quot;Low&amp;quot;,
      status: &amp;quot;Closed&amp;quot;,
      dateUpdated: today() - 2
    ),
    a!map(
      id: 4,
      priority: &amp;quot;High&amp;quot;,
      status: &amp;quot;New&amp;quot;,
      dateUpdated: today() - 1
    ),
    
  },
  
  /* Option 1*/
  a!forEach(
    items: local!cases,
    expression: if(
      fv!item.priority = &amp;quot;Low&amp;quot;,
      fv!item,
      {}
    )
  ),
  
  /* Option 2 */
  index(
    local!cases,
    wherecontains(
      &amp;quot;Low&amp;quot;,
      local!cases.priority
    ),
    {}
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Option 1 uses a!forEach() to do a comparison, so any logical statement can be used to &amp;quot;filter&amp;quot; the data. It works because a!forEach() implicitly flattens all lists, so if you provide an empty list as the response in the false case, those items are filtered out.&lt;/p&gt;
&lt;p&gt;Option 2 uses a combination of index() and wherecontains() that is most useful if you&amp;#39;re specifically looking if a value exists. The where contains tells you which indexes contain that value, and then you return the corresponding indexes from your original dataset with the index() function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89617?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 07:19:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:4b4a180a-15db-4bae-b885-dffad35d7824</guid><dc:creator>Klaus34</dc:creator><description>&lt;p&gt;Actually why i cant edit Stored proc there is one more reason .. elaborating :&lt;/p&gt;
&lt;p&gt;in editable grid there are so many fields like they are getting fetched from stored proc (ri!oldTestData)&lt;br /&gt; and 5 to 10 fields are there which are getting fetched from local subdocs query rule as i have mentioned below two fields .. now i want to apply the filter on first field &amp;quot;Defnination&amp;quot;&lt;/p&gt;
&lt;p&gt;a!local variables (&lt;br /&gt;local!SubDocData: rule!TEST_getAllSubDocEntityIdDocName(),&lt;/p&gt;
&lt;p&gt;local!datasubset: todatasubset(ri!oldTESTData, ri!pagingInfo)&lt;/p&gt;
&lt;p&gt;a!gridLayout(&lt;/p&gt;
&lt;p&gt;headerCells: {}&lt;/p&gt;
&lt;p&gt;columnConfigs:{}&lt;/p&gt;
&lt;p&gt;rows: a!forEach(&lt;br /&gt;items: local!datasubset,&lt;br /&gt;expression: a!gTESTRowLayout(&lt;br /&gt;id: fv!item.entity_ID,&lt;br /&gt;contents: {&lt;/p&gt;
&lt;p&gt;a!richTextDisplayField(&lt;br /&gt;preventWrapping :true,&lt;br /&gt;value: index(&lt;br /&gt;index(&lt;br /&gt;local!SubDocData,&lt;br /&gt;wherecontains(&lt;br /&gt;tointeger(fv!item.entity_ID),&lt;br /&gt;tointeger(local!SubDocData.entityId)&lt;br /&gt;)&lt;br /&gt;),&lt;br /&gt;&amp;quot;definition&amp;quot;,&lt;br /&gt;{}&lt;br /&gt;)),&lt;/p&gt;
&lt;p&gt;a!dropdownField(&lt;br /&gt;required:if(ri!isQCReview, false, true),&lt;br /&gt;placeholder: &amp;quot;-- Select -- &amp;quot;,&lt;br /&gt;choiceLabels:&lt;br /&gt;index(&lt;br /&gt;index(local!questionOptions, &amp;quot;value&amp;quot;, {}),&lt;br /&gt;wherecontains(&lt;br /&gt;cons!TEST_SUB_DOC_QUESTION_IDS[2],&lt;br /&gt;tointeger(&lt;br /&gt;index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})&lt;br /&gt;)&lt;br /&gt;),&lt;br /&gt;{}&lt;br /&gt;)&lt;br /&gt;,&lt;br /&gt;choiceValues:&lt;br /&gt;index(&lt;br /&gt;index(local!questionOptions, &amp;quot;value&amp;quot;, {}),&lt;br /&gt;wherecontains(&lt;br /&gt;cons!TEST_SUB_DOC_QUESTION_IDS[2],&lt;br /&gt;tointeger(&lt;br /&gt;index(local!questionOptions, &amp;quot;questionId&amp;quot;, {})&lt;br /&gt;)&lt;br /&gt;),&lt;br /&gt;{}&lt;br /&gt;)&lt;br /&gt;,&lt;br /&gt;value: upper(fv!item.translationNeeded),&lt;br /&gt;saveInto: {&lt;br /&gt;fv!item.translationNeeded,&lt;br /&gt;a!save(&lt;br /&gt;ri!oldAnswerData[wherecontains(&lt;br /&gt;fv!item.entity_ID, index(ri!oldAnswerData, "entity_ID", {})&lt;br /&gt;)].translationNeeded,&lt;br /&gt;save!value&lt;br /&gt;)&lt;br /&gt;},&lt;br /&gt;disabled: if(&lt;br /&gt;contains(ri!selectedIndices, fv!item.entity_ID),&lt;br /&gt;false,&lt;br /&gt;true&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89616?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 07:01:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bfd826b1-f45d-4a41-b6f1-35df11ed0b71</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Oh.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Changing the SP should not create any problem for the dependents as those new filters inputs, that you will be adding,&amp;nbsp; will only be applied when they are passed. For the rest of the cases, the SP should return a similar type of data.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And anyways, Appian will never recommend filtering the data on the front end, instead of doing it on the backend as it can have a performance impact on the interface/rule and may result in poor UX.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s see what other members have to say about it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89615?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 06:57:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:057f9b81-b094-4d64-8584-bfe32c309bd5</guid><dc:creator>Klaus34</dc:creator><description>&lt;p&gt;Sure,&lt;/p&gt;
&lt;p&gt;Actually in the editable grid i want to&amp;nbsp; apply the filters .. where the data subset in the grid fetch data from stored proc ... ..i cant change the stored proc because of dependents .... so wanted to know the approach to filter the data which was getting fetched from stored proc&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Approach to filter data after fetched from stored procedure</title><link>https://community.appian.com/thread/89612?ContentTypeID=1</link><pubDate>Tue, 11 Jan 2022 06:53:26 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:9aaeaa31-6064-46c4-b192-bbbcfc62860c</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
&lt;p&gt;This really depends on the size of the data and the type of filters you want to apply to the data.&lt;br /&gt;If the size is small, then you can iterate through the data and set &amp;#39;null&amp;#39; where the filter turns out to be false.&amp;nbsp;&lt;br /&gt;And then at the end, reject all the null values.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, I am interested in knowing more about the use case here,&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>