Any one else experiencing issues with both distinct and filter functions since the last upgrade. Both the samples below were working perfectly then there is an upgrade and they stop. I cannot find any documentation saying they were due to change or be discontinued its baffling.
Distinct sample
function housecountinfo() {
var resdets = FeatureSetById($map, "111111111-layer-82", ["REF", "type1", "Status", "Units", "Studio", "onebed", "twobed", "threebed", "fourbed", "fivebedplus"], True);
var resact = Intersects($feature, resdets);
var stats = GroupBy(resact, [{ name: "Ref", expression: "Ref" }, { name: "type", expression: "type1" }, { name: "Status", expression: "Status" }],
[{ name: "Units", expression: "Units", statistic: "SUM" }, { name: "studio", expression: "studio", statistic: "SUM" }, { name: "onebed", expression: "onebed", statistic: "Sum" },
{ name: "twobed", expression: "twobed", statistic: "Sum" }, { name: "threebed", expression: "threebed", statistic: "Sum" }, { name: "fourbed", expression: "fourbed", statistic: "Sum" },
{ name: "fivebedplus", expression: "fivebedplus", statistic: "Sum" }]);
if (Count(stats) > 0) {
var uniqueRefs = Distinct(stats, "Ref");
var result = [];
for (var ref in uniqueRefs) {
var x = ref.Ref;
var filteredStats = Filter(stats, "Ref = @x");
var hncud = createUnitDict(filteredStats, 1, 1);
var ancud = createUnitDict(filteredStats, 2, 1);
var dncud = createUnitDict(filteredStats, 3, 1);
var hucud = createUnitDict(filteredStats, 1, 2);
var aucud = createUnitDict(filteredStats, 2, 2);
var ducud = createUnitDict(filteredStats, 3, 2);
var hcud = createUnitDict(filteredStats, 1, 3);
var acud = createUnitDict(filteredStats, 2, 3);
var dcud = createUnitDict(filteredStats, 3, 3);
var hcdata = {
ref: x,
Notcommenced: { summary: hncud.units + ancud.units + dncud.units },
Underconstruction: { summary: hucud.units + aucud.units + ducud.units },
Completed: { summary: hcud.units + dcud.units + acud.units },
unitbreakdown: {
astudio: [hncud.studio, ancud.studio, dncud.studio, hucud.studio, aucud.studio, ducud.studio, hcud.studio, acud.studio, dcud.studio],
bonebed: [hncud.onebed, ancud.onebed, dncud.onebed, hucud.onebed, aucud.onebed, ducud.onebed, hcud.onebed, acud.onebed, dcud.onebed],
ctwobed: [hncud.twobed, ancud.twobed, dncud.twobed, hucud.twobed, aucud.twobed, ducud.twobed, hcud.twobed, acud.twobed, dcud.twobed],
dthreebed: [hncud.threebed, ancud.threebed, dncud.threebed, hucud.threebed, aucud.threebed, ducud.threebed, hcud.threebed, acud.threebed, dcud.threebed],
efourbed: [hncud.fourbed, ancud.fourbed, dncud.fourbed, hucud.fourbed, aucud.fourbed, ducud.fourbed, hcud.fourbed, acud.fourbed, dcud.fourbed],
ffivebedplus: [hncud.fivebedplus, ancud.fivebedplus, dncud.fivebedplus, hucud.fivebedplus, aucud.fivebedplus, ducud.fivebedplus, hcud.fivebedplus, acud.fivebedplus, dcud.fivebedplus]
}
};
Push(result, hcdata);
}
return result;
} else {
return 9999;
}
}
and filter sample
function createUnitDict(filteredStats, type, status) {
var filtered = First(Filter(filteredStats, "type = @type AND Status = @status"));
if (IsEmpty(filtered)) {
return { units: 0, studio: 0, onebed: 0, twobed: 0, threebed: 0, fourbed: 0, fivebedplus: 0 };
} else {
return { units: filtered.Units, studio: filtered.studio, onebed: filtered.onebed, twobed: filtered.twobed, threebed: filtered.threebed, fourbed: filtered.fourbed, fivebedplus: filtered.fivebedplus };
}
}