Home > Mobile >  i want store (array- of object- of array value )in variable
i want store (array- of object- of array value )in variable

Time:01-06

gstPercent: "25"
hsnCode: "856657089900"
idata: null
materialCode: "212321"
materialName: "216465132"
pricing: {pricingHistory: [
salesPricing: 1235
 ]
}
status: true 

given data

and am trying:

var sellingPrice = matListOfOne.find(p => p.pricing.pricingHistory.filter(function (s){
    return s.salesPricing;
}));

CodePudding user response:

The array should contain numerous sting values or objects.

The correct json should be :

gstPercent: "25",
hsnCode: "856657089900",
idata: null,
materialCode: "212321",
materialName: "216465132",
pricing: {pricingHistory:[
{salesPricing: '1235'}
 ]
}

Your code should work now

CodePudding user response:

this works //storing pricing obj in varibale

var pricing = oneMatData.find(function (p) {
                return p.pricing;` `
            }).pricing;

var salesPricing = pricing.pricingHistory[0].salesPricing;

  •  Tags:  
  • Related