bb521e49d628cb84664fadd1a3656de0aa6edfa4
FAQ/Questions/Add-Formatting-Options.md
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | Here we will show you how to easily add a new formatting option to the "Formats" dropdown menu on the Fields tab of the Report Designer. These should be handled in your ``InitializeReporting()`` method in your global.asax. |
| 8 | 8 | |
| 9 | -##Method 1 |
|
| 9 | +##Example 1 - Bold |
|
| 10 | 10 | |
| 11 | 11 | In this example, we will quickly add a new format option to the list called "Bold". New formats added this way will be available for every type of data and will not override the existing built-in formats for each type of data. The symbol {0} acts as a token to represent the data that is returned by the query. |
| 12 | 12 | |
| ... | ... | @@ -14,7 +14,7 @@ In this example, we will quickly add a new format option to the list called "Bol |
| 14 | 14 | AdHocSettings.Formats.Add("Bold", "<strong>{0}</strong>"); |
| 15 | 15 | ``` |
| 16 | 16 | |
| 17 | -##Method 2 |
|
| 17 | +##Example 2 - Scientific |
|
| 18 | 18 | |
| 19 | 19 | We can also use an Izenda Format object as an argument. Below is the method of adding a formatting option called "Scientific" to the list of formats. Items added this way can be made available for specific **SqlTypeGroups** and will not override any of the existing formats. |
| 20 | 20 | |
| ... | ... | @@ -23,6 +23,26 @@ We can also use an Izenda Format object as an argument. Below is the method of a |
| 23 | 23 | AdHocSettings.Formats.Add("Scientific", scientificFormat); |
| 24 | 24 | ``` |
| 25 | 25 | |
| 26 | +##Example 3 - International Date Formats |
|
| 27 | + |
|
| 28 | +In this example, we show how to set the formats when using an International Date format. This example is for the European Date format and needs to be placed in the ``InitializeReporting()`` method of your global.asax file. |
|
| 29 | + |
|
| 30 | +```csharp |
|
| 31 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 32 | +{ |
|
| 33 | + // Configure settings |
|
| 34 | + |
|
| 35 | + // Add Custom Setting below license key and connection string setting |
|
| 36 | + public override void ConfigureSettings() |
|
| 37 | + { |
|
| 38 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 39 | + AdHocSettings.Formats.Add("EuroDate", "{0:dd/MM/yyyy}"); |
|
| 40 | + } |
|
| 41 | +} |
|
| 42 | +``` |
|
| 43 | + |
|
| 44 | +You can use this example as a template for other date formats as well. |
|
| 45 | + |
|
| 26 | 46 | ##Results |
| 27 | 47 | |
| 28 | 48 | Below are screenshots of the results. The one directly below this text shows the OrderID field (a number field) with both of our new functions listed. |