*/
public JSONArray getMeasuresConfigurationScript(DataMart datamart) throws JSONException {
JSONArray measures;
IDataStore dataStore;
IDataStoreMetaData dataStoreMeta;
List measureFieldsMeta;
String[] measureNames;
measures = new JSONArray();
dataStore = datamart.getDataStore();
dataStoreMeta = dataStore.getMetaData();
measureFieldsMeta = dataStoreMeta.findFieldMeta("ROLE", "MEASURE");
measureNames = new String[ measureFieldsMeta.size() ];
for(int i = 0; i < measureNames.length; i++) {
IFieldMetaData filedMeta = (IFieldMetaData)measureFieldsMeta.get(i);
measureNames[i] = filedMeta.getName();
}
for(int i = 0; i < measureNames.length; i++) {
JSONObject measure = new JSONObject();
measure.put("name", measureNames[i]);
measure.put("description", getMeasure(measureNames[i]).getDescription());
measure.put("colour", getMeasure(measureNames[i]).getColour());
JSONArray orderedValues = new JSONArray();
dataStore.sortRecords( dataStoreMeta.getFieldIndex(measureNames[i]) );
List orderedKpiValuesSet = dataStore.getFieldValues( dataStoreMeta.getFieldIndex(measureNames[i]) );
Iterator it = orderedKpiValuesSet.iterator();
while(it.hasNext()) {
orderedValues.put( it.next() );
}
measure.put("ordered_values", orderedValues);