I currently have a dashboard that combines multiple layers through data expression. How can I make the Details widget show attachments? I have already enabled the Attachements button in the Details option.
var portal = Portal('https://www.arcgis.com/')
//Create a feature set for each point, line, and polygon layer and include the cost feild
var A_fs = FeatureSetByPortalItem(portal, '2acf48490fbc47d2b99e06f84c0dbe24', 0, ['OBJECTID','ServiceArea','BusinessZone','DMACode','MeterNumber','Status','NewReading'], false)
var B_fs = FeatureSetByPortalItem(portal, '75079cb03040425793197f87b65d242f', 0, ['OBJECTID','ServiceArea','BusinessZone','DMACode','MeterNumber','Status','NewReading'], false)
var C_fs = FeatureSetByPortalItem(portal, 'ca1c074acd7742edab0497bec288d6df', 0, ['OBJECTID','ServiceArea','BusinessZone','DMACode','MeterNumber','Status','NewReading'], false)
var D_fs = FeatureSetByPortalItem(portal, 'fb75429710e247949fb8ad861558b253', 0, ['OBJECTID','ServiceArea','BusinessZone','DMACode','MeterNumber','Status','NewReading'], false)
var E_fs = FeatureSetByPortalItem(portal, '0baa26106ff44aaa82cfa3a209dd1e7e', 0, ['OBJECTID','ServiceArea','BusinessZone','DMACode','MeterNumber','Status','NewReading'], false)
var F_fs = FeatureSetByPortalItem(portal, '04f7ee15087148e3844593afd158fd8f', 0, ['OBJECTID','ServiceArea','BusinessZone','DMACode','MeterNumber','Status','NewReading'], false)
//Create an empty array and variable for the new FeatureSet that you will push/combine your features into
var features = [];
var feat;
//Push each feature from each layer into the empty array
for (var f in A_fs) {
feat = {
'attributes': {
'OBJECTID': f['OBJECTID'],
'ServiceArea': f['ServiceArea'],
'BusinessZone': f['BusinessZone'],
'DMACode': f['DMACode'],
'MeterNumber': f['MeterNumber'],
'Status': f['Status'],
'NewReading': f['NewReading'],
}
};
Push(features, feat)
}
for (var f in B_fs) {
feat = {
'attributes': {
'OBJECTID': f['OBJECTID'],
'ServiceArea': f['ServiceArea'],
'BusinessZone': f['BusinessZone'],
'DMACode': f['DMACode'],
'MeterNumber': f['MeterNumber'],
'Status': f['Status'],
'NewReading': f['NewReading'],
}
};
Push(features, feat)
}
for (var f in C_fs) {
feat = {
'attributes': {
'OBJECTID': f['OBJECTID'],
'ServiceArea': f['ServiceArea'],
'BusinessZone': f['BusinessZone'],
'DMACode': f['DMACode'],
'MeterNumber': f['MeterNumber'],
'Status': f['Status'],
'NewReading': f['NewReading'],
}
};
Push(features, feat)
}
for (var f in D_fs) {
feat = {
'attributes': {
'OBJECTID': f['OBJECTID'],
'ServiceArea': f['ServiceArea'],
'BusinessZone': f['BusinessZone'],
'DMACode': f['DMACode'],
'MeterNumber': f['MeterNumber'],
'Status': f['Status'],
'NewReading': f['NewReading'],
}
};
Push(features, feat)
}
for (var f in E_fs) {
feat = {
'attributes': {
'OBJECTID': f['OBJECTID'],
'ServiceArea': f['ServiceArea'],
'BusinessZone': f['BusinessZone'],
'DMACode': f['DMACode'],
'MeterNumber': f['MeterNumber'],
'Status': f['Status'],
'NewReading': f['NewReading'],
}
};
Push(features, feat)
}
for (var f in F_fs) {
feat = {
'attributes': {
'OBJECTID': f['OBJECTID'],
'ServiceArea': f['ServiceArea'],
'BusinessZone': f['BusinessZone'],
'DMACode': f['DMACode'],
'MeterNumber': f['MeterNumber'],
'Status': f['Status'],
'NewReading': f['NewReading'],
}
};
Push(features, feat)
}
//Create final FeatureSet from combined features
var combinedDict = {
'fields': [
{ 'name': 'OBJECTID', 'type': 'esriFieldTypeString' },
{ 'name': 'ServiceArea', 'type': 'esriFieldTypeString' },
{ 'name': 'BusinessZone', 'type': 'esriFieldTypeString' },
{ 'name': 'DMACode', 'type': 'esriFieldTypeString' },
{ 'name': 'MeterNumber', 'type': 'esriFieldTypeString' },
{ 'name': 'Status', 'type': 'esriFieldTypeString' },
{ 'name': 'NewReading', 'type': 'esriFieldTypeInteger' },
],
'geometryType': '',
'features': features,
};
return FeatureSet(Text(combinedDict));