enhance filter
diff --git a/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF b/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF
index 57f9e3f..0f9a439 100644
--- a/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.xtext.datamart.common/META-INF/MANIFEST.MF
@@ -30,6 +30,7 @@
  org.eclipse.osbp.dsl.semantic.common.types;version="0.9.0",
  org.eclipse.osbp.dsl.semantic.entity;version="0.9.0",
  org.eclipse.osbp.preferences;version="0.9.0",
+ org.eclipse.osbp.preferences.databases.vendors,
  org.eclipse.osbp.runtime.common.i18n;version="0.9.0",
  org.eclipse.osbp.ui.api.datamart;version="0.9.0",
  org.eclipse.osbp.ui.api.date;version="0.9.0",
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java
index 86a91f9..0504ffc 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/ADatamart.java
@@ -21,13 +21,13 @@
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.osbp.preferences.EnumDatabaseVendor;
 import org.eclipse.osbp.preferences.ProductConfiguration;
+import org.eclipse.osbp.preferences.databases.vendors.DatabaseVendor;
 import org.eclipse.osbp.runtime.common.event.IDualData;
 import org.eclipse.osbp.ui.api.datamart.DatamartFilter;
 import org.eclipse.osbp.ui.api.datamart.DatamartFilter.FilterType;
+import org.eclipse.osbp.ui.api.datamart.DatamartFilter.MultipleType;
 import org.eclipse.osbp.ui.api.datamart.IDataMart;
-import org.eclipse.osbp.ui.api.datamart.IDatamartBetweenInput;
 
 /**
  * The Class ADatamart.
@@ -91,7 +91,7 @@
 	public abstract void disconnect();
 	
 	/** The db vendor. */
-	protected EnumDatabaseVendor dbVendor = null;
+	protected DatabaseVendor dbVendor = null;
     
     /** The filter map. */
     private ArrayList<DatamartFilter> filterMap = null;
@@ -226,19 +226,6 @@
 						filter.setCondition(filter.getName()+"="+filter.getSql());
 					}
 					break;
-				case SINGLE:
-				case SINGLESLICER:
-				case SINGLEHIERARCHY:
-				case SINGLEHIERARCHYCHILDREN:
-					if(!filter.getSelectedData().isEmpty()) {
-						filter.setCondition(filter.getSelectedData().get(0).getDatabaseSelectionValue());
-						if(filter.getType()==FilterType.SINGLEHIERARCHYCHILDREN) {
-							filter.setCondition(filter.getCondition()+".Children");
-						}
-					} else {	// failsafe - but only if filter is optional
-						filter.setCondition("'*'");
-					}
-					break;
 				case BETWEEN:
 				case BETWEEN_DATE:
 					if(filter.getBetweenInputComponent() != null) {
@@ -259,10 +246,9 @@
 						filter.setCondition("1=1");
 					}
 					break;
+				case SQL:
 				case EXCEPT:
-				case MULTIPLE:
-				case MULTIPLEHIERARCHY:
-				case MULTIPLEHIERARCHYCHILDREN:
+				case HIERARCHY:
 					String selection = "";
 					for(IDualData item : filter.getSelectedData()) {
 						if (item != null) {
@@ -270,25 +256,31 @@
 								selection += ",";
 							}
 							selection += item.getDatabaseSelectionValue();
-							if(filter.getType()==FilterType.MULTIPLEHIERARCHYCHILDREN) {
-								selection += ".Children";
+							switch (filter.getType()) {
+								case HIERARCHY:
+									selection += ".Children";
+									filter.setCondition("{"+selection+"}");
+									break;
+								case EXCEPT:
+									filter.setCondition("{"+selection+"}");
+									break;
+								case SQL:
+									filter.setCondition(selection);
+								default:
+									break;
 							}
 
 						}
 					}
-					if(!filter.getSelectedData().isEmpty()) {
-						if(filter.getType()==FilterType.MULTIPLEHIERARCHYCHILDREN) {
-							filter.setCondition("{"+selection+"}");
+					if(selection.isEmpty()) {
+						if(filter.isOptional()) {
+							filter.setCondition("'*'");
 						} else {
-							filter.setCondition(selection);
+							filter.setCondition(null);
 						}
-					} else if(filter.getType() == FilterType.EXCEPT) {
-						filter.setCondition("");
-					} else {
-						filter.setCondition("'*'");
 					}
 					break;
-				case MULTIPLESLICER:
+				case SLICER:
 					// all multiple slicer filters are accumulated to the first filter multiple slicer filter
 					List<String> myList = new ArrayList<>();
 					for (IDualData item : filter.getSelectedData()) {
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartDefinitionUtil.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartDefinitionUtil.java
index a564ed1..9a723e7 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartDefinitionUtil.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartDefinitionUtil.java
@@ -53,21 +53,42 @@
 			!entityRef.getSuperType().equals(entityRef);
 	}
 
-	public static String getEntityIdAliasName(LEntity entityRef) {
-		LEntityAttribute idAttribute = entityRef.getPrimaryKeyAttribute();
-		return getEntityIdAliasName(entityRef, idAttribute);
+	public static String getEntityIdAliasName(LEntity entity) {
+		LEntityAttribute idAttribute = entity.getPrimaryKeyAttribute();
+		return getEntityIdAliasName(entity, idAttribute);
 	}
 
+	public static String getEntityValidAliasName(LEntity entity) {
+		if(!entity.isHistorizedOrTimedependentWithParent()) {
+			return null;
+		}
+		if(hasSuperType(entity)) {
+			return IDataMart.DATAMART_VALID_COLUMN_PREFIX+entity.getSuperType().getName()+IDataMart.DATAMART_VALID_COLUMN_POSTFIX;
+		} else {
+			return IDataMart.DATAMART_VALID_COLUMN_PREFIX+entity.getName()+IDataMart.DATAMART_VALID_COLUMN_POSTFIX;
+		}
+	}
+
+	public static String getEntityCurrentAliasName(LEntity entity) {
+		if(!entity.isHistorizedOrTimedependentWithParent()) {
+			return null;
+		}
+		if(hasSuperType(entity)) {
+			return IDataMart.DATAMART_CURRENT_COLUMN_PREFIX+entity.getSuperType().getName()+IDataMart.DATAMART_CURRENT_COLUMN_POSTFIX;
+		} else {
+			return IDataMart.DATAMART_CURRENT_COLUMN_PREFIX+entity.getName()+IDataMart.DATAMART_CURRENT_COLUMN_POSTFIX;
+		}
+	}
 	
-	public static String getEntityIdAliasName(LEntity entityRef, LEntityAttribute idAttribute) {
+	public static String getEntityIdAliasName(LEntity entity, LEntityAttribute idAttribute) {
 		if	(idAttribute == null) {
 			return null;
 		}
 		else {
-			if(hasSuperType(entityRef)) {
-				return IDataMart.DATAMART_ID_COLUMN_PREFIX+entityRef.getSuperType().getName()+IDataMart.DATAMART_ID_COLUMN_POSTFIX;
+			if(hasSuperType(entity)) {
+				return IDataMart.DATAMART_ID_COLUMN_PREFIX+entity.getSuperType().getName()+IDataMart.DATAMART_ID_COLUMN_POSTFIX;
 			} else {
-				return IDataMart.DATAMART_ID_COLUMN_PREFIX+entityRef.getName()+IDataMart.DATAMART_ID_COLUMN_POSTFIX;
+				return IDataMart.DATAMART_ID_COLUMN_PREFIX+entity.getName()+IDataMart.DATAMART_ID_COLUMN_POSTFIX;
 			}
 		}
 	}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java
index 8a741bc..5f582ea 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartFilterGenerator.java
@@ -25,8 +25,10 @@
 import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent;
 import org.eclipse.osbp.runtime.common.event.EventDispatcherEvent.EventDispatcherDataTag;
 import org.eclipse.osbp.runtime.common.event.IDualData;
+import org.eclipse.osbp.runtime.common.historized.UUIDHist;
 import org.eclipse.osbp.ui.api.datamart.DatamartFilter;
 import org.eclipse.osbp.ui.api.datamart.DatamartFilter.FilterType;
+import org.eclipse.osbp.ui.api.datamart.DatamartFilter.MultipleType;
 import org.eclipse.osbp.ui.api.datamart.IDataMart;
 import org.eclipse.osbp.ui.api.datamart.IDatamartBetweenInput;
 import org.eclipse.osbp.ui.api.datamart.IDatamartFilterGenerator;
@@ -137,7 +139,7 @@
 			ArrayList<DatamartFilter> filters = datamart.getFilters();
 			if (filters != null) {
 				for (DatamartFilter filter : filters) {
-					if(filter.getType() != DatamartFilter.FilterType.BY_ID && filter.getName().equals(filterID)) {
+					if(filter.getType() != DatamartFilter.FilterType.BY_ID && filter.getType() != DatamartFilter.FilterType.BY_HISTUUID && filter.getName().equals(filterID)) {
 						for(IDualData item : filter.getData()) {
 							if(item.getSelectionValue().equals(sel)) {
 								filter.getSelector().select(item);
@@ -159,6 +161,7 @@
 		for(DatamartFilter filter : datamart.getFilters()) {
 			switch (filter.getType()) {
 			case BY_ID:
+			case BY_HISTUUID:
 				if(byId && event.getData().containsKey(EventDispatcherDataTag.ID)) {
 					Object id = event.getData().get(EventDispatcherDataTag.ID);
 					if(event.getTopic().endsWith(filter.getShortName())) {
@@ -166,6 +169,8 @@
 							filter.setSql(((Integer)id).toString());
 						} else if (id instanceof String) {
 							filter.setSql("'"+(String)id+"'");
+						} else if (id instanceof UUIDHist) {
+							filter.setSql("'"+((UUIDHist)id).id+"'");
 						} else {
 							filter.setSql("");
 						}
@@ -173,32 +178,16 @@
 					}
 				}
 				break;
-			case SINGLE:
-				if(filter.canSelectData(event.getData(), false, false)) {
-					filter.getSelector().select(filter.getSelectedData().get(0));
-					return false;
-				}
-				break;
-			case MULTIPLE:
-				if(filter.canSelectData(event.getData(), true, false)) {
-					filter.getSelector().select(filter.getSelectedData());
-					return false;
-				}
-				break;
-			case SINGLESLICER:
-			case SINGLEHIERARCHY:
-			case SINGLEHIERARCHYCHILDREN:
-				if(filter.canSelectData(event.getData(), false, true)) {
-					filter.getSelector().select(filter.getSelectedData().get(0));
-					return false;
-				}
-				break;
+			case SQL:
+			case SLICER:
+			case HIERARCHY:
 			case EXCEPT:
-			case MULTIPLESLICER:
-			case MULTIPLEHIERARCHY:
-			case MULTIPLEHIERARCHYCHILDREN:
-				if(filter.canSelectData(event.getData(), true, true)) {
-					filter.getSelector().select(filter.getSelectedData());
+				if(filter.canSelectData(event.getData())) {
+					if(filter.getSelector() instanceof DatamartSingleSelect) {
+						filter.getSelector().select(filter.getSelectedData().get(0));
+					} else if(filter.getSelector() instanceof DatamartMultiSelect) {
+						filter.getSelector().select(filter.getSelectedData());
+					}
 					return false;
 				}
 				break;
@@ -242,29 +231,28 @@
 				for (DatamartFilter filter : filters) {
 					switch (filter.getType()) {
 					case BY_ID:
+					case BY_HISTUUID:
 						break;
-					case SINGLE:
-					case SINGLESLICER:
-					case SINGLEHIERARCHY:
-					case SINGLEHIERARCHYCHILDREN:
-						filter.setSelector((IDatamartSelectable)filterFactory.getUiFilter(filter, numMultiRows));
-						layoutManager.getTopArea().addComponent((Component)filter.getSelector());
-						break;
+					case SQL:
+					case SLICER:
 					case EXCEPT:
-					case MULTIPLE:
-					case MULTIPLESLICER:
-					case MULTIPLEHIERARCHY:
-					case MULTIPLEHIERARCHYCHILDREN:
+					case HIERARCHY:
 						filter.setSelector((IDatamartSelectable)filterFactory.getUiFilter(filter, numMultiRows));
-						layoutManager.getSideArea().addComponent((Component)filter.getSelector());
+						if(filter.getMultipleType() == MultipleType.MULTIPLE) {
+							layoutManager.getSideArea().addComponent((Component)filter.getSelector());
+						} else {
+							layoutManager.getTopArea().addComponent((Component)filter.getSelector());
+						}
 						break;
 					case BETWEEN:
 					case BETWEEN_DATE:
 						filter.setBetweenInputComponent((IDatamartBetweenInput)filterFactory.getUiFilter(filter, numMultiRows));
 						layoutManager.getTopArea().addComponent((Component) filter.getBetweenInputComponent());
 						break;
+					default:
+						break;
 					}
-					if(filter.getType() != DatamartFilter.FilterType.BY_ID) {
+					if(filter.getType() != DatamartFilter.FilterType.BY_ID && filter.getType() != DatamartFilter.FilterType.BY_HISTUUID) {
 						if (DatamartFilter.FilterType.BETWEEN == filter.getType() || DatamartFilter.FilterType.BETWEEN_DATE == filter.getType()){
 							filter.getBetweenInputComponent().addValueChangeListener(this);
 						} else {
@@ -311,28 +299,26 @@
 					filter.clearSelectedData();
 					switch (filter.getType()) {
 					case BY_ID:
-						break;
-					case SINGLE:
-					case SINGLESLICER:
-					case SINGLEHIERARCHY:
-					case SINGLEHIERARCHYCHILDREN:
-						if(filter.getSelector().getValue() != null) {
-							filter.addSelectedItem((IDualData)filter.getSelector().getValue());
-						} else {
-							filter.clearSelectedData();
-							allFiltersSet = false;
-						}
+					case BY_HISTUUID:
 						break;
 					case EXCEPT:
 						filter.setSelectedData(filter.getSelector().getSelectedItems());
 						break;
-					case MULTIPLE:
-					case MULTIPLESLICER:
-					case MULTIPLEHIERARCHY:
-					case MULTIPLEHIERARCHYCHILDREN:
-						filter.setSelectedData(filter.getSelector().getSelectedItems());
-						if(filter.getSelector().getSelectedItems().isEmpty()) {
-							allFiltersSet = false;
+					case SQL:
+					case SLICER:
+					case HIERARCHY:
+						if(filter.getSelector() instanceof DatamartSingleSelect) {
+							if(filter.getSelector().getValue() != null) {
+								filter.addSelectedItem((IDualData)filter.getSelector().getValue());
+							} else {
+								filter.clearSelectedData();
+								allFiltersSet = false;
+							}
+						} else {
+							filter.setSelectedData(filter.getSelector().getSelectedItems());
+							if(filter.getSelector().getSelectedItems().isEmpty()) {
+								allFiltersSet = false;
+							}
 						}
 						break;
 					default:
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java
index b32c205..2ea52a9 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartMultiSelect.java
@@ -26,12 +26,12 @@
 
 import com.vaadin.data.Container;
 import com.vaadin.ui.ListSelect;
+import com.vaadin.ui.UI;
 
 public class DatamartMultiSelect extends ListSelect implements
 		IDatamartSelectable {
 
 	private static final long serialVersionUID = 7284120542309904692L;
-	private boolean slicer = false;
 	private String hierarchy = null;
 	private IDualData firstItem = null;
 	private boolean selectFirst;
@@ -43,10 +43,8 @@
 		return (obj.size() > 0);
 	}
 
-	public DatamartMultiSelect(int rowsLimit, boolean isExcept,
-			boolean isSlicer, boolean selectFirst, Collection<IDualData> data) {
+	public DatamartMultiSelect(int rowsLimit, boolean selectFirst, Collection<IDualData> data) {
 		addStyleName(EnumCssClass.MULTI_SELECTION.styleName());
-		slicer = isSlicer;
 		this.selectFirst = selectFirst;
 		setMultiSelect(true);
 		update(data);
@@ -61,10 +59,6 @@
 		return serialVersionUID;
 	}
 
-	public boolean isSlicer() {
-		return slicer;
-	}
-
 	public DatamartMultiSelect() {
 	}
 
@@ -74,11 +68,9 @@
 	 * @param options
 	 */
 	public void update(Collection<IDualData> options) {
-		getUI().getCurrent().access(new Runnable() {
+		UI.getCurrent().access(new Runnable() {
 			@Override
 			public void run() {
-// Temporarily not in use to avoid a loop due to the dependency from org.eclipse.osbp.runtime.web to this bundle
-//				VaadinObservables.activateRealm(getUI().getCurrent());
 				removeAllItems();
 				firstItem = null;
 				for (IDualData dd : options) {
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java
index 280eec2..fab085e 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartSingleSelect.java
@@ -24,27 +24,21 @@
 
 import com.vaadin.data.Container;
 import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.UI;
 
 public class DatamartSingleSelect extends ComboBox implements
 		IDatamartSelectable {
 
 	private static final long serialVersionUID = -5673052113801450589L;
 	private String hierarchy = null;
-	private boolean slicer = false;
 	private IDualData firstItem = null;
 
 	public static long getSerialversionuid() {
 		return serialVersionUID;
 	}
 
-	public boolean isSlicer() {
-		return slicer;
-	}
-
-	public DatamartSingleSelect(boolean isExcept, boolean isSlicer,
-			Collection<IDualData> data) {
+	public DatamartSingleSelect(Collection<IDualData> data) {
 		addStyleName(EnumCssClass.SINGLE_SELECTION.styleName());
-		slicer = isSlicer;
 		update(data);
 	}
 
@@ -57,7 +51,7 @@
 	 * @param options
 	 */
 	public void update(Collection<IDualData> options) {
-		getUI().getCurrent().access(new Runnable() {
+		UI.getCurrent().access(new Runnable() {
 			@Override
 			public void run() {
 				removeAllItems();
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java
index c767738..ba23239 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/DatamartUiFilterFactory.java
@@ -18,7 +18,7 @@
 import java.util.Map;
 
 import org.eclipse.osbp.ui.api.datamart.DatamartFilter;
-import org.eclipse.osbp.ui.api.datamart.IDatamartFilterGenerator;
+import org.eclipse.osbp.ui.api.datamart.DatamartFilter.FilterType;
 
 import com.vaadin.ui.Component;
 
@@ -27,34 +27,25 @@
 	public Component getUiFilter(DatamartFilter filter, int numMultiRows){
 		Component component = uiFilters.get(filter.getName());
 		if (component == null) {
-			switch (filter.getType()) {
-			case BY_ID:
-				break;
+			switch (filter.getMultipleType()) {
 			case SINGLE:
-			case SINGLEHIERARCHY:
-			case SINGLEHIERARCHYCHILDREN:
-				uiFilters.put(filter.getName(), new DatamartSingleSelect(false, false, filter.getData()));
-				break;
-			case SINGLESLICER:
-				uiFilters.put(filter.getName(), new DatamartSingleSelect(false, true, filter.getData()));
-				break;
-			case EXCEPT:
-				uiFilters.put(filter.getName(), new DatamartMultiSelect(numMultiRows, false, true, false, filter.getData()));
+				uiFilters.put(filter.getName(), new DatamartSingleSelect(filter.getData()));
 				break;
 			case MULTIPLE:
-			case MULTIPLEHIERARCHY:
-			case MULTIPLEHIERARCHYCHILDREN:
-				uiFilters.put(filter.getName(), new DatamartMultiSelect(numMultiRows, false, false, true, filter.getData()));
+				uiFilters.put(filter.getName(), new DatamartMultiSelect(numMultiRows, (filter.getType() != FilterType.EXCEPT), filter.getData()));
 				break;
-			case MULTIPLESLICER:
-				uiFilters.put(filter.getName(), new DatamartMultiSelect(numMultiRows, false, true, true, filter.getData()));
+			default:
 				break;
+			}
+			switch (filter.getType()) {
 			case BETWEEN:
 				uiFilters.put(filter.getName(), new DatamartBetweenText());
 				break;
 			case BETWEEN_DATE:
 				uiFilters.put(filter.getName(), new DatamartBetweenDate(filter.format, filter.resolution));
 				break;
+			default:
+				break;
 			}
 			component = uiFilters.get(filter.getName());
 		}	
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/CellSetToD3JsonConverter.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/CellSetToD3JsonConverter.java
index c2fb3f8..2d8ef39 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/CellSetToD3JsonConverter.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/CellSetToD3JsonConverter.java
@@ -132,7 +132,7 @@
 			} else {
 				jsonRowsDataArray = new JreJsonArray(factory);
 			}
-			jsonRowsDataArray.set(jsonArray.length(), childrenListMap);
+			jsonRowsDataArray.set(jsonRowsDataArray.length(), childrenListMap);
 			jsonMap.put(KEY_CHILDREN, jsonRowsDataArray);
 		} else {
 			jsonChildrenArray = createJsonMapStructure(jsonChildrenArray, tokenList, childrenListMap);
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedCell.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedCell.java
index e3d9635..d60ed7c 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedCell.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/olap/DerivedCell.java
@@ -15,7 +15,10 @@
  */
  package org.eclipse.osbp.xtext.datamart.common.olap;
 
+import java.math.BigDecimal;
+
 import org.eclipse.osbp.xtext.datamart.common.sql.SqlCell;
+import org.olap4j.OlapException;
 
 import mondrian.olap.Cell;
 
@@ -44,9 +47,20 @@
 
 	public Object getValue(){
 		if (olapCell!=null){
+			if(olapCell.getValue() instanceof BigDecimal) {
+				try {
+					return olapCell.getDoubleValue();
+				} catch (OlapException e) {
+					return 0.0;
+				}
+			}
 			return olapCell.getValue();
 		} else if (mondrianCell!=null){
-			return mondrianCell.getValue();
+			value = mondrianCell.getValue(); 
+			if(value instanceof BigDecimal) {
+				return ((BigDecimal)value).doubleValue();
+			}
+			return value;
 		} else {
 			return value;
 		}
diff --git a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java
index 4b1f134..edb0bb5 100644
--- a/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java
+++ b/org.eclipse.osbp.xtext.datamart.common/src/org/eclipse/osbp/xtext/datamart/common/sql/SqlCellSet.java
@@ -39,11 +39,13 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.eclipse.osbp.bpm.api.BPMTaskSummary;
 import org.eclipse.osbp.dsl.common.datatypes.IDto;
+import org.eclipse.osbp.runtime.common.historized.UUIDHist;
 import org.eclipse.osbp.ui.api.datamart.DatamartPrimary;
 import org.eclipse.osbp.ui.api.datamart.IDataMart;
 import org.eclipse.osbp.ui.api.datamart.IDataMart.AttributeVisibility;
@@ -283,18 +285,16 @@
 		return null;
 	}
 
-	public SqlCellSet(ResultSet rs, ResultSetMetaData metaData, IUser user, Map<String, String> resultAttributes, Map<Integer,ArrayList<String>> axisMap, Map<String, EType> idMap,  Map<String, String> aliasMap,  Map<String, IDataMart.AttributeVisibility> hiddenMap, DatamartDtoMapper datamartDtoMapper, Class<?> operativeDtoClass, List<IDto> operativeDtos, List<DatamartPrimary<?>> primaryKeys, IUserAccessService pUserAccessService) { //NOSONAR
+	public SqlCellSet(ResultSet rs, ResultSetMetaData metaData, IUser user, Map<String, String> resultAttributes, Map<Integer,ArrayList<String>> axisMap, Map<String, EType> idMap,  Map<String, String> aliasMap,  Map<String, IDataMart.AttributeVisibility> hiddenMap, DatamartDtoMapper datamartDtoMapper, Class<?> operativeDtoClass, List<IDto> operativeDtos, Map<String, DatamartPrimary> primaryMap, IUserAccessService pUserAccessService, boolean isHistorized) { //NOSONAR
 		fCells = new ArrayList<>();
 		fAxes = new ArrayList<>();
 		sqlAxes = new ArrayList<>();
 		this.userAccessService = pUserAccessService;
 		operativeDtoContainer = null;
-		Map<String, DatamartPrimary> primaryMap = new HashMap<>();
-		for(DatamartPrimary<?> pr : primaryKeys) {
-			pr.clear();
-			primaryMap.put(pr.getAlias(), pr);
-		}
 		int numColumns = 0;
+		for(Entry<String, DatamartPrimary> p:primaryMap.entrySet()) {
+			p.getValue().clear();
+		}
 		SqlCellSetAxis sqlCellSetAxis = null;
 		try {
 			if(!rs.isClosed()) {
@@ -307,11 +307,11 @@
 		try {
 			if(!rs.isClosed()) {
 				if (!axisMap.keySet().isEmpty()) {
-					for (int axisNumber : axisMap.keySet()) {
+					for(int axisNumber=0; axisNumber<axisMap.size();axisNumber++) {
 						sqlCellSetAxis = new SqlCellSetAxis(this, axisNumber);
 						if (axisNumber == 0) {	// the columns axis
 							int ordinal = 0;
-							for (String columnLabel : axisMap.get(0)) {
+							for (String columnLabel : axisMap.get(axisNumber)) {
 								try {
 									int columnIdx = rs.findColumn(columnLabel);
 									sqlCellSetAxis.addPosition(axisNumber, ordinal, convertToMemberType(rs, metaData, columnIdx), metaData.getColumnName(columnIdx), metaData.getColumnLabel(columnIdx));
@@ -389,7 +389,11 @@
 											}
 											
 											if(primaryMap.containsKey(columnLabel)) {
-												primaryMap.get(columnLabel).add(value);
+												if(isHistorized) {
+													primaryMap.get(columnLabel).add(new UUIDHist((String)value, (long)getCastedValue(rs, metaData, columnIdx+1)));
+												} else {
+													primaryMap.get(columnLabel).add(value);
+												}
 											}
 						    				if (axisMap.keySet().size() > 1 && axisMap.get(1).contains(columnLabel)) {
 						    					sqlAxes.get(1).addPosition(1, targetRowNo, convertToMemberType(rs, metaData, columnIdx), formattedValue, columnLabel);
@@ -398,7 +402,9 @@
 									    		row[ordinal] = new SqlCell(this, targetRowNo, ordinal, value, formattedValue, isId(columnLabel, idMap), getType(idMap));
 									    		ordinal ++;
 						    				}
-										} catch (SQLException e) {}
+										} catch (SQLException e) {
+											LOGGER.error("{}", e);
+										}
 									}
 								}
 			    			}
@@ -516,6 +522,7 @@
 	private Object getCastedValue(ResultSet rs, ResultSetMetaData metaData, int idx) throws SQLException {
 		int type = metaData.getColumnType(idx);
 		int scale = metaData.getScale(idx);
+		int precision = metaData.getPrecision(idx);
 		
 		switch (type) {
 		case java.sql.Types.DATE:
@@ -530,12 +537,17 @@
 		case java.sql.Types.BIGINT:
 			return rs.getBigDecimal(idx);
 		case java.sql.Types.INTEGER:
+			return (int) rs.getInt(idx);
 		case java.sql.Types.BOOLEAN:
 		case java.sql.Types.BIT:
 			return (int) rs.getInt(idx);
 		case java.sql.Types.NUMERIC:
 			if(scale == 0) {
-				return rs.getInt(idx);
+				if(precision > 10) {
+					return rs.getLong(idx);
+				} else {
+					return rs.getInt(idx);
+				}
 			}
 			return rs.getDouble(idx);
 		case java.sql.Types.DECIMAL:
@@ -586,7 +598,7 @@
     		case java.sql.Types.BOOLEAN:
     		case java.sql.Types.BIT:
     		case java.sql.Types.NUMERIC:
-   				formattedValue = Integer.toString(rs.getInt(idx));
+   				formattedValue = Long.toString(rs.getLong(idx));
     			break;
     		case java.sql.Types.DECIMAL:
     		case java.sql.Types.DOUBLE: