export.js
//Verify that only indicators are used in favourites
Verify that only indicators are used in favourites
Verify that only indicators are used in favourites
function validateFavoriteDataItems() {
	var issues = [];
	for (var type of ["charts", "mapViews", "reportTables", "visualizations"]) {
		for (var i = 0; metaData.hasOwnProperty(type) && i < metaData[type].length; i++) {
			var item = metaData[type][i];
			for (var dimItem of item.dataDimensionItems) {
				if (dimItem.dataDimensionItemType != "INDICATOR") {
					var abort = customObject(type, item.id) ? false : true;
					var nameableItem = (type == "mapViews") ? mapFromMapView(item.id) : item;
					issues.push({
						"id": nameableItem.id,
						"name": nameableItem.name,
						"type": type,
						"error": dimItem.dataDimensionItemType,
						"abort": abort
					});
				}
			}
		}
	}
	if (issues.length > 0) {
		console.log("\nWARNING | Favourites not using indicators only:");
		abort = false;
		var printed = {};
		for (var issue of issues) {
			abort = abort || issue.abort;
			if (!printed[issue.id + issue.error]) {
				console.log(issue.type + ": " + issue.id + " - '" + issue.name +
					"': " + issue.error);
				printed[issue.id + issue.error] = true;
			}
		}
		return !abort;
	}
	else return true;
}
function validateFavoriteDataItems ( ) { var issues = [ ] ; for ( var type of [ "charts" , "mapViews" , "reportTables" , "visualizations" ] ) { for ( var i = 0 ; metaData . hasOwnProperty ( type ) && i < metaData [ type ] . length ; i ++ ) { var item = metaData [ type ] [ i ] ; for ( var dimItem of item . dataDimensionItems ) { if ( dimItem . dataDimensionItemType != "INDICATOR" ) { var abort = customObject ( type , item . id ) ? false : true ; var nameableItem = ( type == "mapViews" ) ? mapFromMapView ( item . id ) : item ; issues . push ( { "id" : nameableItem . id , "name" : nameableItem . name , "type" : type , "error" : dimItem . dataDimensionItemType , "abort" : abort } ) ; } } } } if ( issues . length > 0 ) { console . log ( "\nWARNING | Favourites not using indicators only:" ) ; abort = false ; var printed = { } ; for ( var issue of issues ) { abort = abort || issue . abort ; if ( ! printed [ issue . id + issue . error ] ) { console . log ( issue . type + ": " + issue . id + " - '" + issue . name + "': " + issue . error ) ; printed [ issue . id + issue . error ] = true ; } } return ! abort ; } else return true ; }
Verify that only indicators are used in favourites
Verify that only indicators are used in favourites
//Data elements from favorites //added visualizations for 2.34 //Exception: custom objects we list, but don't stop the export