aggregate total count

return new Promise((resolve, reject) => {
  Promise.all([Me.getConfigData({
        "groupType": "source",
        "groupName": "PublicWIFI",
        "configName": "digitalInteractivePanel",
        "tenantId": "ndmc.com"
    })]).then(gresponse => {
  var active=0;
         var data2 = gresponse[0].result;
    var data3= Object.values(data2);
   active =  data3.reduce((ele,acc)=>{return ele+acc.details_by_ssid['Signpost-FREE-Wifi']['active_users']},0);
     

    var output=[];

    output.push({
       "val": data3.length,
      "key": "Total Access Points",
      "order": 1
    });
    output.push({
       "val": active,
      "key": "Active Users",
      "order": 2
    });
    resolve({"result": {"data": output,"metaInfo": Me.props.metaInfo}});
  }).catch(error => {
    resolve({"result": {"data": [],"metaInfo": Me.props.metaInfo}});
  });
});



//


greponse
[
  {
    "result": {
      "1": {
        "name": "A1",
        "location": "UCB Corner",
        "latitude": "28.63229",
        "longitude": "77.21825",
        "last_update": "2020-03-03 18:24:48",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "2": {
        "name": "A2",
        "location": "Nr. Vinod Kr & Co. and Money Changer(/Post Office )",
        "latitude": "28.63295",
        "longitude": "77.21837",
        "last_update": "2020-02-29 23:59:48",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "3": {
        "name": "A3",
        "location": "KFC",
        "latitude": "28.63309",
        "longitude": "77.21805",
        "last_update": "2020-03-03 18:24:47",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "4": {
        "name": "A8 ",
        "location": "KFC",
        "latitude": "28.63328",
        "longitude": "77.21802",
        "last_update": "2020-03-03 01:59:00",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "5": {
        "name": "A4",
        "location": "Near Wenger's/ Nirmal Vijay & Co",
        "latitude": "28.63353",
        "longitude": "77.21833",
        "last_update": "2020-03-03 18:24:53",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 3479698,
            "active_users": 1,
            "active_bandwidth_used": 31.114788004137
          }
        }
      },
      "6": {
        "name": "A7 ",
        "location": "Near Wenger's/ Nirmal Vijay & Co",
        "latitude": "28.63351",
        "longitude": "77.21844",
        "last_update": "2020-03-03 18:24:46",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 353510,
            "active_users": 1,
            "active_bandwidth_used": 578.44584382872
          }
        }
      },
      "7": {
        "name": "A5",
        "location": "Beside UCB ",
        "latitude": "28.63210",
        "longitude": "77.21795",
        "last_update": "2020-03-03 16:18:48",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 4366,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "8": {
        "name": "B1",
        "location": "Near Options",
        "latitude": "28.63379",
        "longitude": "77.21814",
        "last_update": "2020-03-03 18:24:46",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 31753,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "9": {
        "name": "B2",
        "location": "H&M",
        "latitude": "28.63404",
        "longitude": "77.21876",
        "last_update": "2020-03-03 18:24:47",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 678289,
            "active_users": 1,
            "active_bandwidth_used": 382.78970223325
          }
        }
      },
      "10": {
        "name": "B3",
        "location": "Colonade",
        "latitude": "28.63407",
        "longitude": "77.21888",
        "last_update": "2020-03-03 18:24:46",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 77846,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "11": {
        "name": "B6",
        "location": "Colonade",
        "latitude": "28.63403",
        "longitude": "77.21896",
        "last_update": "2020-03-03 18:24:55",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 963517,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "12": {
        "name": "B4",
        "location": "Nr. Indian Terrain",
        "latitude": "28.63428",
        "longitude": "77.21971",
        "last_update": "2020-03-03 18:24:47",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 93075,
            "active_users": 1,
            "active_bandwidth_used": 32.128205128205
          }
        }
      },
      "13": {
        "name": "B5",
        "location": "Opp. Nirmal Vijay Jewellers",
        "latitude": "28.63377",
        "longitude": "77.21812",
        "last_update": "2020-02-26 17:33:06",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "14": {
        "name": "C1",
        "location": "Nr. Jain Book Depot",
        "latitude": "28.63448",
        "longitude": "77.21982",
        "last_update": "2020-03-03 18:24:39",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 85025,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "15": {
        "name": "C2",
        "location": "Nr. Van Huesen Showroom",
        "latitude": "28.63426",
        "longitude": "77.22055",
        "last_update": "2020-03-03 18:25:07",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "16": {
        "name": "C3",
        "location": "Looks Salon",
        "latitude": "28.63451",
        "longitude": "77.21991",
        "last_update": "2020-03-03 18:24:49",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 145261,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "17": {
        "name": "C4",
        "location": "Openhouse Cafe",
        "latitude": "28.63442",
        "longitude": "77.22052",
        "last_update": "2020-03-03 18:25:08",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "18": {
        "name": "D1",
        "location": "Nr. Guete Reise",
        "latitude": "28.63407",
        "longitude": "77.2208",
        "last_update": "2020-03-03 18:24:53",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 7905,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "19": {
        "name": "D2 ",
        "location": "Embassy Corner",
        "latitude": "28.63404",
        "longitude": "77.22081",
        "last_update": "2020-03-03 18:24:59",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 124331,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "20": {
        "name": "D5",
        "location": "Embassy Corner",
        "latitude": "28.63402",
        "longitude": "77.22088",
        "last_update": "2020-02-29 23:57:56",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "21": {
        "name": "D3",
        "location": "End of Embassy Opp Palace Heights/ Union Bank",
        "latitude": "28.63369",
        "longitude": "77.22139",
        "last_update": "2020-03-03 18:24:53",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 3845,
            "active_users": 1,
            "active_bandwidth_used": 78.857142857143
          }
        }
      },
      "22": {
        "name": "D4",
        "location": "Opp. Khan Chacha",
        "latitude": "28.63420",
        "longitude": "77.22084",
        "last_update": "2020-03-03 18:25:07",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 70431,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "23": {
        "name": "E1",
        "location": "Jump Showroom",
        "latitude": "28.63357",
        "longitude": "77.22148",
        "last_update": "2020-03-03 18:24:44",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "24": {
        "name": "E6",
        "location": "Jump Showroom",
        "latitude": "28.63353",
        "longitude": "77.22147",
        "last_update": "2020-02-28 18:25:55",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "25": {
        "name": "E2",
        "location": "Samsonite",
        "latitude": "28.63286",
        "longitude": "77.22132",
        "last_update": "2020-03-03 18:24:44",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "26": {
        "name": "E3",
        "location": "Farzi Cafe",
        "latitude": "28.63255",
        "longitude": "77.22138",
        "last_update": "2020-02-28 08:36:36",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "27": {
        "name": "E4",
        "location": "Levi's",
        "latitude": "28.63210",
        "longitude": "77.22111",
        "last_update": "2020-03-03 18:25:09",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 428061,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "28": {
        "name": "E7",
        "location": "Levi's",
        "latitude": "28.63207",
        "longitude": "77.22085",
        "last_update": "2020-03-03 18:24:56",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "29": {
        "name": "E5",
        "location": "Beside Jump Showroom",
        "latitude": "28.63357",
        "longitude": "77.22151",
        "last_update": "2020-03-03 18:24:28",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "30": {
        "name": "F1",
        "location": "Kalpana",
        "latitude": "28.63183",
        "longitude": "77.22098",
        "last_update": "2020-03-03 18:24:41",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "31": {
        "name": "F2",
        "location": "Cantabil",
        "latitude": "28.63163",
        "longitude": "77.22058",
        "last_update": "2020-03-03 18:24:58",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "32": {
        "name": "F7",
        "location": "Cantabil",
        "latitude": "28.63164",
        "longitude": "77.22063",
        "last_update": "2020-03-03 18:25:09",
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 695252,
            "active_users": 1,
            "active_bandwidth_used": 465.19705093834
          }
        }
      },
      "33": {
        "name": "F3",
        "location": "Woodland",
        "latitude": "28.63173",
        "longitude": "77.22016",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "34": {
        "name": "F4",
        "location": "Ruby Radio",
        "latitude": "28.63147",
        "longitude": "77.22032",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "35": {
        "name": "F5",
        "location": "Opp. Mufti Showroom",
        "latitude": "28.63139",
        "longitude": "77.22004",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "36": {
        "name": "F6",
        "location": "Opp. Sony Centre",
        "latitude": "28.63081",
        "longitude": "77.21971",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "37": {
        "name": "G1",
        "location": "Near Sports Station",
        "latitude": "28.63186",
        "longitude": "77.21704",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "38": {
        "name": "G2",
        "location": "Opp. Baggit",
        "latitude": "28.63167",
        "longitude": "77.21607",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "39": {
        "name": "G3",
        "location": "Raddisson Blu Hotel",
        "latitude": "28.63416",
        "longitude": "77.21755",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "40": {
        "name": "H1",
        "location": "Opp Uco Bank",
        "latitude": "28.63413",
        "longitude": "77.21777",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "41": {
        "name": "H2",
        "location": "Nr. Khadi India",
        "latitude": "28.63425",
        "longitude": "77.21734",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "42": {
        "name": "H3",
        "location": "Punjab & Sindh Bank",
        "latitude": "28.63586",
        "longitude": "77.21976",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "43": {
        "name": "K1",
        "location": "Khoobchand & Bros",
        "latitude": "28.63538",
        "longitude": "77.22006",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "44": {
        "name": "L1",
        "location": "Nr. Haldiram's",
        "latitude": "28.63416",
        "longitude": "77.22235",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "45": {
        "name": "M1",
        "location": "Nr. Kanika/ Opp. Haldiram's",
        "latitude": "28.63404",
        "longitude": "77.22247",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "46": {
        "name": "M2",
        "location": "Nr. Chillis Restaurant",
        "latitude": "28.63148",
        "longitude": "77.22253",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "47": {
        "name": "N1",
        "location": "Nr. Addidas Store",
        "latitude": "28.63103",
        "longitude": "77.22256",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "48": {
        "name": "N2",
        "location": "Opp. Playboy Cafe/ My Bar",
        "latitude": "28.63064",
        "longitude": "77.21986",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "49": {
        "name": "N3",
        "location": "Nr. Dunkin's Donought",
        "latitude": "28.63034",
        "longitude": "77.21980",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      },
      "50": {
        "name": "N4",
        "location": "Nr. Dominos Pizza",
        "latitude": "28.63033",
        "longitude": "77.21973",
        "last_update": null,
        "details_by_ssid": {
          "Signpost-FREE-Wifi": {
            "total_data_used": 0,
            "active_users": 0,
            "active_bandwidth_used": 0
          }
        }
      }
    }
  }
]

Comments

Popular posts from this blog

config aggregate and map

convert to ISO format