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
Can you please explain it more
Okay. i will explain the above exmaple.
I have data list and Items list. data list contains a product name and Demand count. item list contains the set of spareparts that are required manufacture the product. example data[1] is [product=Wi-Fi Router, Demand=500, productid=], for this product we have spare parts items[1] is
Now i want to know in data list i have a variable called Demand it should compare the the all the count variable items[1] i.e the spare part list (5 list) and return the Fv!item that are less than Demand Value
so in second example, it will return null right?As all the count values are greater than demand value.
but for second we have check with data[2] [product=Wi-Fi Extender, Demand=7, productid=] with items[2].
from data[1] with items[1] , data[2] with items[2]..... like this
Yes, in item2 all the items have count greater than 7. So it has to return null right?
Yes
As fas as I understand, is this what you're looking for?
a!forEach( items: local!data, expression: a!localVariables( local!demand: fv!item.demand, local!item: local!items[fv!index], a!map( result: reject( fn!isnull, a!forEach( items: local!item, expression: if( tointeger(local!demand) > tointeger(fv!item.count), fv!item, null() ) ) ) ) ) )
What's the problem?
Hey Aryan,
i want to show the Spare parts and Demand value respectively in a Editable grid as shown below, i was able to get the Item names but the QTY here refer to Demand value. but here iam getting 1st items from the list 294 demand value for every row
aryan said:What's the problem?
The comment you're replying to is just a spambot.