Filter Data Issue

Hi All , 

I am facing one issue Appian

I have Two Filter Area and Zone  to extract the data in table  example like 

Area is multiple drop down having value's A , B ,C , D , E , F , G 

and 

Zone  is multiple drop  down having a , b , c, d , e , f , g ,h  , i 

if we select the Area A then Zone should show  b , c , d instead of a , b , c , d , e , f ,g , h , i  similarly if we select Area B Zone should show e , f , g instead of a , b , c ,d ,e , f ,g , h ,i   so what would be condition 

i m using like this 

a!multipleDropdownField(
label: "Area",
labelPosition: "ADJACENT",
choiceLabels: index(
local!varriable(Exp Rule ).data,
"field 1",
null
),
choiceValues: index(
local!varriable.data,
"field1",
null
),
value: local!selectedArea,

saveInto: {local!selectedArea,a!save(local!pagingInfo1,local!fPagingInfo2)},
validations: {}
),

a!multipleDropdownField(
label: "Zone",
labelPosition: "ADJACENT",
choiceLabels: index(
local!varriable2(Exp Rule ).data,
"field2 ",
null
),
choiceValues: index(
local!varriable2.data,
"field2",
null
),
value: local!selectedZone,

saveInto: {local!selectedZone,a!save(local!pagingInfo1,local!fPagingInfo2)},
validations: {}
),

  Discussion posts and replies are publicly visible

  • The key part here is what you didn't include: the expression rule that gets the data for your choice labels / choice values for the second dropdown. Essentially you want to use this interface pattern for cascading dropdowns: https://docs.appian.com/suite/help/atest/recipe-configure-cascading-dropdowns.html

    To set this up, you need the labels / values for the second dropdown to use a condition (either an if statement, decision rule, query, or even use choose() like in the attached example). Then, when you select something from the first dropdown, the second dropdown will update to show you the new values.

  • Hi,

    Table should be in this pattern

    Area Id Zone Id
    A a
    A b
    A c
    A d
    B e
    B f
    B g
    C a
    C b
    C c
    C d
    D e
    D f
    D g

    or you can create local variable while retrieving the data based on condition

    Code snippets:

    a!multipleDropdownField(
    label: "Area",
    labelPosition: "ADJACENT",
    choiceLabels:local!areaValues

    choiceValues:local!areaValues,

    value:local!selectedArea,

    saveInto:{

    local!selectedArea,

    a!save(local!zoneValues,

    rule!getZoneBySelectedArea(local!selectedArea)}),

    a!multipleDropdownField(
    label: "Area",
    labelPosition: "ADJACENT",
    choiceLabels:local!zoneValues

    choiceValues:local!zoneValues,

    value:local!selectedZone,

    saveInto:{

    local!selectedZone})

    rule!getZoneBySelectedArea(local!selectedArea) ----- This is query rule, you have to fetch from data base based on the selectarea

    Should be like this.

    Hope it will help

    Regards,

    Bhanu.

  • If you use a table like this, then the function defined as "getZoneBySelectedArea" should use a!queryEntity() to filter based on the selected Area(s). That function could look something like this:

    a!queryEntity(
      entity: cons!ZONE_AREA_ENTITY,
      query: a!query(
        pagingInfo: a!pagingInfo(
          startIndex: 1,
          batchSize: -1,
          sort: a!sortInfo(
            field: "zone",
            ascending: true
          )
        ),
        filter: a!queryFilter(
          field: "zone",
          operator: "in",
          value: local!selectedArea
        )
      )
    )