df29fb78a0ae780f1bee67410c90285d12c6c517
FAQ/Questions/Adding-Custom-Time-Periods.md
| ... | ... | @@ -2,7 +2,13 @@ |
| 2 | 2 | |
| 3 | 3 | [[_TOC_]] |
| 4 | 4 | |
| 5 | -##Adding Custom TimePeriods |
|
| 5 | +##Question |
|
| 6 | + |
|
| 7 | +How can I add a new time period to the list of time period filter options? |
|
| 8 | + |
|
| 9 | +##Answer |
|
| 10 | + |
|
| 11 | +You can use our [[CustomTimePeriods|/API/CodeSamples/CustomTimePeriods]] setting to dynamically add time periods with a **StartDate** and a **TimePeriod**. |
|
| 6 | 12 | |
| 7 | 13 | Here is an example of how to add custom time spans to the filters. Apply this code within [[InitializeReporting()|/FAQ/InitializeReporting]] in your Global.asax. |
| 8 | 14 | |
| ... | ... | @@ -15,7 +21,7 @@ if (!AdHocSettings.CustomTimePeriods.ContainsKey("Lunar Cycle")) { |
| 15 | 21 | } |
| 16 | 22 | ``` |
| 17 | 23 | |
| 18 | -Since we didn't specify a **StartDate**, Izenda will assume the server's current time as the **StartDate** of the time period. If we run a report with an **in time period** filter on OrderDate that used **lunar cycle** as its time period on March 4, 2015 at 3:46:58 PM, the query results of this would like similar to the below SQL: |
|
| 24 | +Since we didn't specify a **StartDate**, Izenda will assume the server's current date and time as the **StartDate** of the time period. If we run a report with an **in time period** filter on OrderDate that used **lunar cycle** as its time period on March 4, 2015 at 3:46:58 PM, the query results of this would like similar to the below SQL: |
|
| 19 | 25 | |
| 20 | 26 | ```sql |
| 21 | 27 | SELECT TOP 100000 |
| ... | ... | @@ -56,14 +62,4 @@ You may at any time modify your existing set of custom time periods. You cannot, |
| 56 | 62 | ```csharp |
| 57 | 63 | CustomTimePeriod ctp = AdHocSettings.CustomTimePeriods["Lunar Cycle"]; |
| 58 | 64 | ctp.StartDate = DateTime.Now + ctp.Period; //passed by reference so the original list will update |
| 59 | -``` |
|
| 60 | - |
|
| 61 | -##Screenshots |
|
| 62 | - |
|
| 63 | -###Report Designer |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - |
|
| 67 | -###Report Viewer |
|
| 68 | - |
|
| 69 | - |
|
| ... | ... | \ No newline at end of file |
| 0 | +``` |
|
| ... | ... | \ No newline at end of file |