// Get the Item Portal FeatureSet var fs = FeatureSetByPortalItem(Portal('https://sgmai.maps.arcgis.com'), 'cc483edaa0f3457c8cd99149d36c1ced', 0, ['selec', 'CreationDate'], false); // Filter AEO records and sort by creation date var fsAEO = Filter(fs, "selec = 'AEO'"); var sortedFS = OrderBy(fsAEO, 'CreationDate DESC'); // Create a list to store the modified records var updatedFeatures = []; // Iterate over the records and modify the date for (var feature in sortedFS) { // Obter a data de criação var creationDate = Date(feature.CreationDate);
// Add 3 days to the date var newDate = DateAdd(creationDate, 3, 'days');
// Create a New Object with the Date Modified var updatedFeature = { 'attributes': { 'selec': feature.selec, 'CreationDate': newDate } };
// Add the new object to the list Push(updatedFeatures, updatedFeature); } // Create a New FeatureSet with the Modified Records var updatedFeatureSet = { 'fields': [ {'name': 'selec', 'type': 'esriFieldTypeString'}, {'name': 'CreationDate', 'type': 'esriFieldTypeDate'} ], 'geometryType': '', 'features': updatedFeatures }; // Return the Modified FeatureSet return FeatureSet(Text(updatedFeatureSet)); |