I have a form with two filters Area and Zone

Customer name group product area zone
xyz x1 p1 A a
abc x2 p2 A b
mno x1 p1 A c
opq x3 p3 B d
qrs x4 p4 B e
tre x5 p6 B f

Hi All , 

I have two filters Suppose Area and Zone to filter the data Area and zone have different values both filters are drop dow

Ex - if we will select the Area value A  then in Zone  filter will show only Option a , b , c instead of a , b , c ,d ,e ,f  and if we initiate with filter F2 Value e then it should show only option B instead of A , B.... i cant understand the logic 

  Discussion posts and replies are publicly visible

Parents
  • Hi

    You can have a multiple dropdown field to select multiple areas and get the index of the selected areas to fetch the respective zones. Have a look at this

    load(
      
      local!cdt:{{customerName:"xyz", group:"x1", product: "p1", area:"A", zone:"a"},
      {customerName:"abc", group:"x2", product: "p2", area:"A", zone:"b"},
      {customerName:"mno", group:"x1", product: "p1", area:"A", zone:"c"},
      {customerName:"opq", group:"x3", product: "p3", area:"B", zone:"d"},
      {customerName:"qrs", group:"x4", product: "p4", area:"B", zone:"e"},
      {customerName:"tre", group:"x5", product: "p6", area:"B", zone:"f"}},
      
      
      local!selectedArea,
      local!selectedZone,
      local!zones,
     
      {
        a!sectionLayout(
          label:"Filter Criteria",
          contents: {
            a!multipleDropdownField(
              label:"Area",
              choiceLabels: union(local!cdt.area,local!cdt.area),
              choiceValues: union(local!cdt.area,local!cdt.area),
              placeholderLabel: "Select",
              value:local!selectedArea,
              saveInto: {local!selectedArea,
              a!save(local!zones, (index(local!cdt.zone, wherecontains(apply(tostring(_),local!selectedArea),apply(tostring(_),local!cdt.area)),{}))),
              a!save(local!selectedZone, if(contains(apply(tostring(_),local!zones),tostring(local!selectedZone)),local!selectedZone,null))
              }
            ),
            
            if(rule!APN_isEmpty(local!selectedArea),{},
             a!dropdownField(
              label:"Zone",
              choiceLabels: union(local!zones,local!zones),
              choiceValues: union(local!zones,local!zones),
              placeholderLabel: "Select",
              value:local!selectedZone,
              saveInto: local!selectedZone
            )
           
            )
            
          }
        )
        
      }
      
    )

Reply
  • Hi

    You can have a multiple dropdown field to select multiple areas and get the index of the selected areas to fetch the respective zones. Have a look at this

    load(
      
      local!cdt:{{customerName:"xyz", group:"x1", product: "p1", area:"A", zone:"a"},
      {customerName:"abc", group:"x2", product: "p2", area:"A", zone:"b"},
      {customerName:"mno", group:"x1", product: "p1", area:"A", zone:"c"},
      {customerName:"opq", group:"x3", product: "p3", area:"B", zone:"d"},
      {customerName:"qrs", group:"x4", product: "p4", area:"B", zone:"e"},
      {customerName:"tre", group:"x5", product: "p6", area:"B", zone:"f"}},
      
      
      local!selectedArea,
      local!selectedZone,
      local!zones,
     
      {
        a!sectionLayout(
          label:"Filter Criteria",
          contents: {
            a!multipleDropdownField(
              label:"Area",
              choiceLabels: union(local!cdt.area,local!cdt.area),
              choiceValues: union(local!cdt.area,local!cdt.area),
              placeholderLabel: "Select",
              value:local!selectedArea,
              saveInto: {local!selectedArea,
              a!save(local!zones, (index(local!cdt.zone, wherecontains(apply(tostring(_),local!selectedArea),apply(tostring(_),local!cdt.area)),{}))),
              a!save(local!selectedZone, if(contains(apply(tostring(_),local!zones),tostring(local!selectedZone)),local!selectedZone,null))
              }
            ),
            
            if(rule!APN_isEmpty(local!selectedArea),{},
             a!dropdownField(
              label:"Zone",
              choiceLabels: union(local!zones,local!zones),
              choiceValues: union(local!zones,local!zones),
              placeholderLabel: "Select",
              value:local!selectedZone,
              saveInto: local!selectedZone
            )
           
            )
            
          }
        )
        
      }
      
    )

Children
No Data