Compare and get the ItemName

Certified Lead Developer

 Hi team,

Iam building a logic where i have two lists as listed below, now i want to check data[1] i.e, wifi Router Demand value 500 with all (5 items)count values in Items[1] . and same data[2] with items[2] with all 5 count values in items[2] and return the sparepart Names that are less than demand value.

1. data: [product=Wi-Fi Router, Demand=500, productid=]; [product=Wi-Fi Extender, Demand=7, productid=]

2.items:{

{{Sparepart: "Wi-Fi Module", count: 100, productid: 1},

{Sparepart: "Antenna", count: 100, productid: 1},

{Sparepart: "Power Supply Unit", count: 100, productid: 1},

{Sparepart: "Ethernet Port", count: 100, productid: 1},

{Sparepart: "CPU Chip", count: 100, productid: 1}

},

{

{Sparepart: "Wi-Fi Extender Module", count: 20, productid: 2},

{Sparepart: "Extension Antenna", count: 30, productid: 2},

{Sparepart: "Power Adapter", count: 15, productid: 2},

{Sparepart: "Ethernet Cable", count: 25, productid: 2},

{Sparepart: "Signal Booster", count: 10, productid: 2}

}

}

i tried with the following, but for Demand i used a flag variable at last. i am unable to understand who to achieve this. please help me in solving this.

a!localVariables(
  local!flag:1,
  local!data: ri!DemandProduct,
  local!items: a!forEach(
    items: local!data,
    expression: rule!SCM_Sparepartsdata(local!data[fv!index].product)
  ),
  a!forEach(
    items: local!items,
    expression: a!forEach(
      items: local!items[fv!index],
      expression: {a!forEach(
        items:{ fv!item.count},
        /*expression: if(fv!item>local!data[1].Demand,fv!item ," ")*/
        expression:if(
          fv!item < local!data[local!flag].Demand,
          fv!item,
          " "
        ),
        
        
      ),
      
      }
    )
  )
)

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data