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

Is it possible to filter Dataquest that is created using a!foreach?

Certified Associate Developer

Hello,

I've created a datasubset using a!foreach. Now want to filter the data on the datasubset depending on the value for one field. Can you please suggest on this?

a high level snippet is below. Below rule returns a datasubset & on that datasubset I am trying add a filter. 

todatasubset(

a!forEach(
items: rule!Irulename(),
expression: 'type!{urn:com:appian:types:cdt}|cdt_name'(
fields:,
completed: rule!newRuleToupdateafield
)
)

)

  Discussion posts and replies are publicly visible

Parents
  • As an example, try this in a blank interface:

    a!localVariables(
      local!options: {"A","B","C","D"},
      local!selected: null,
      local!data: todatasubset(
        a!flatten(
          fn!reject(
            fn!isnull,
            a!forEach(
            items: local!options,
            expression: if(
              fv!item=local!selected,
              null,
              {
                data: fv!item
              }
            )
          )
          )
        )
      ),
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!dropdownField(
                label: "Filter Out",
                choiceLabels: local!options,
                choiceValues: local!options,
                placeholder: "-- Select --",
                value: local!selected,
                saveInto: local!selected
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!richTextDisplayField(
                label: "Result",
                value: a!forEach(
                  items: local!data,
                  expression: {
                    a!richTextItem(
                      text: fv!item.data
                    ),
                    char(13)
                  }
                )
              )
            }
          )
        }
      )
    )

Reply
  • As an example, try this in a blank interface:

    a!localVariables(
      local!options: {"A","B","C","D"},
      local!selected: null,
      local!data: todatasubset(
        a!flatten(
          fn!reject(
            fn!isnull,
            a!forEach(
            items: local!options,
            expression: if(
              fv!item=local!selected,
              null,
              {
                data: fv!item
              }
            )
          )
          )
        )
      ),
      a!columnsLayout(
        columns: {
          a!columnLayout(
            contents: {
              a!dropdownField(
                label: "Filter Out",
                choiceLabels: local!options,
                choiceValues: local!options,
                placeholder: "-- Select --",
                value: local!selected,
                saveInto: local!selected
              )
            }
          ),
          a!columnLayout(
            contents: {
              a!richTextDisplayField(
                label: "Result",
                value: a!forEach(
                  items: local!data,
                  expression: {
                    a!richTextItem(
                      text: fv!item.data
                    ),
                    char(13)
                  }
                )
              )
            }
          )
        }
      )
    )

Children