public static <T, S> void selectGroupedFields(CriteriaBuilder cb,
			CriteriaQuery<S> criteria, Root<T> root, List<String> group) {
		List<Selection<?>> listSelection = new ArrayList<Selection<?>>();
		if (group != null) {
			for (String currentVal : group) {
				/**
				 * separate field and function
				 */
				String[] splitCurrentVal = currentVal.split(",");
				Path<String> path = getPath(root, splitCurrentVal[0]);

				if (path != null) {
					/**
					 * if have aggregation function
					 */
					if (splitCurrentVal.length == 2) {
						/**
						 * aggregation functions
						 */
						Expression<?> expr = getExpressionPathAndFunctions(cb,
								path, splitCurrentVal[0], splitCurrentVal[1]);
						if (expr != null) {
							listSelection.add(expr);
						}
					}
					listSelection.add(path);
				}
			}
		}
		criteria.multiselect(listSelection);
	}