public static FieldSchema GetSchemaForType(PivotViewerPropertyType type) { switch (type) { case PivotViewerPropertyType.DateTime: return(dateTimeSchema); case PivotViewerPropertyType.Decimal: return(decimalSchema); case PivotViewerPropertyType.Text: return(stringSchema); case PivotViewerPropertyType.Link: return(linkSchema); } return(null); }
private static string GetFormatString(FacetCategory category, PivotViewerPropertyType propType) { var format = category.Format; // special case for decimal with the "C[#]" format if (propType == PivotViewerPropertyType.Decimal && !string.IsNullOrEmpty(category.Format) && category.Format.StartsWith("C")) { format = "'$'##,0"; if (category.Format.Length <= 1 || !int.TryParse(category.Format.Substring(1, 1), NumberStyles.Any, CultureInfo.InvariantCulture, out int digits)) { digits = 2; } if (digits > 0) { format = string.Concat(format, "."); format.PadRight(digits, '0'); } } return(format); }
private static PivotViewerPropertyOptions GetPropertyOptions(FacetCategory category, PivotViewerPropertyType type) { var option = PivotViewerPropertyOptions.None; if (category.Type == FacetType.LongString) { option |= PivotViewerPropertyOptions.WrappingText; } if (!category.IsFilterVisibleSpecified || category.IsFilterVisible) { option |= PivotViewerPropertyOptions.CanFilter; } if (category.IsMetaDataVisibleSpecified && !category.IsMetaDataVisible) { option |= PivotViewerPropertyOptions.Private; } if ((!category.IsWordWheelVisibleSpecified || category.IsWordWheelVisible) && PivotViewerProperty.IsSearchableSchemaType(type)) { option |= PivotViewerPropertyOptions.CanSearchText; } return(option); }