FAQ/ProcessDataSet.md
... ...
@@ -173,145 +173,4 @@ public override void ProcessDataSet(DataSet ds, string reportPart)
173 173
174 174
##Bulk CSV
175 175
176
-Due to the nature of the way the bulk CSV export runs, the above methods will not work for this type of export. In order to handle bulk CSV data, use the ProcessDataRow override instead.
177
-
178
-###Example: Using post-processing
179
-
180
-C♯:
181
-
182
-```csharp
183
-public override void ProcessDataRow(DataRow row, Report report, bool isTotals)
184
-{
185
- // We want to alter only "Detail" part of the report set
186
- if (report.Name == "Detail")
187
- {
188
- if (row != null)
189
- {
190
- // Iterate through columns to find column with name "Ship Region"
191
- foreach (DataColumn col in row.Table.Columns)
192
- {
193
- if (col.ColumnName == "Ship Region")
194
- {
195
- // Iterate through rows to find the field with a value of "CA"
196
- if (row[col].ToString() == "CA")
197
- row[col] = "California";
198
- // There can be only one column with a specific name,
199
- // so we can leave the cycle as soon as we find it
200
- break;
201
- }
202
- }
203
- }
204
- }
205
-}
206
-```
207
-
208
-VB.NET
209
-
210
-```visualbasic
211
-Public Overrides Sub ProcessDataRow(row As DataRow, report As Report, isTotals As Boolean)
212
- 'We want to alter only "Detail" part of the report set
213
- If report.Name = "Detail" Then
214
- If row IsNot Nothing Then
215
- 'Iterate through columns to find column with name "Ship Region"
216
- For Each col As DataColumn In row.Table.Columns
217
- If col.ColumnName = "Ship Region" Then
218
- If row(col).ToString() = "CA" Then row(col) = "California"
219
- 'There can be only one column with a specific name,
220
- 'so we can leave the cycle as soon as we find it
221
- Exit For
222
- End If
223
- Next
224
- End If
225
- End If
226
-End Sub
227
-
228
-```
229
-
230
-###Example: Dynamically changing time zones
231
-
232
-C♯:
233
-
234
-```csharp
235
-public override void ProcessDataRow(DataRow row, Report report, bool isTotals)
236
-{
237
- if (row.Table.Columns.Count == 0)
238
- return;
239
- // Iterate through ALL DateTime values and change values according to the local TimeZone
240
- // Note: you could also change some fields only
241
- foreach (DataColumn column in row.Table.Columns)
242
- if (column.DataType == typeof(DateTime))
243
- row[column] = GetLocalTime((DateTime)row[column]);
244
-}
245
-
246
-private static DateTime GetLocalTime(DateTime utcTime)
247
-{
248
- // The only way to get user local time is to get in on the client-side (using javascript)
249
- // Izenda already have this functionality, so you could use IZR_TimeZone session variable
250
- // OR you may want to detect user TimeZone using your own methods
251
- if (HttpContext.Current.Session["IZR_TimeZone"] == null)
252
- return utcTime;
253
- return utcTime.AddMinutes((int)HttpContext.Current.Session["IZR_TimeZone"]);
254
-}
255
-```
256
-
257
-VB.NET
258
-
259
-```visualbasic
260
-Public Overrides Sub ProcessDataRow(row As DataRow, report As Report, isTotals As Boolean)
261
- If (row Is Nothing) Then
262
- Return
263
- End If
264
- ' Iterate through ALL DateTime values and change values according to the local TimeZone
265
- ' Note: you could also change some fields only
266
- For Each column As System.Data.DataColumn In row.Table.Columns
267
- If (column.DataType Is GetType(DateTime)) Then
268
- row(column) = GetLocalTime(CType(row(column), DateTime))
269
- End If
270
- Next
271
-End Sub
272
-
273
-Private Function GetLocalTime(utcTime As DateTime) As DateTime
274
- ' The only way to get user local time is to get in on the client-side (using javascript)
275
- ' Izenda already have this functionality, so you could use IZR_TimeZone session variable
276
- ' OR you may want to detect user TimeZone using your own methods
277
- If (HttpContext.Current.Session("IZR_TimeZone") Is Nothing) Then
278
- Return utcTime
279
- End If
280
- Return utcTime.AddMinutes(DirectCast(HttpContext.Current.Session("IZR_TimeZone"), Integer))
281
-End Function
282
-```
283
-
284
-###Example: Fetching a Column Used in a Report
285
-
286
-C♯:
287
-
288
-```csharp
289
-public override void ProcessDataRow(DataRow row, Report report, bool isTotals)
290
-{
291
- string columnToDecrypt = "[dbo].[Orders].[CustomerID]";
292
- if (report.Name == "Gauges" && row != null)
293
- {
294
- ReportSet crs = AdHocContext.CurrentReportSet;
295
- if (crs != null && crs.Reports.Contains("Gauges") && crs.Reports["Gauges"] != null && crs.Reports["Gauges"].Fields[0].ColumnName == columnToDecrypt)
296
- {
297
- // Decrypt ds.Tables[0].Columns[0]
298
- // ...
299
- }
300
- }
301
-}
302
-```
303
-
304
-VB.NET:
305
-
306
-```visualbasic
307
-Public Overrides Sub ProcessDataRow(row As DataRow, report As Report, isTotals As Boolean)
308
- Dim columnToDecrypt As String = "[dbo].[Orders].[CustomerID]"
309
- If report.Name = "Gauges" AndAlso row IsNot Nothing Then
310
- Dim crs As ReportSet = AdHocContext.CurrentReportSet
311
- If (crs IsNot Nothing AndAlso crs.Reports.Contains("Gauges") AndAlso crs.Reports("Gauges") IsNot Nothing AndAlso crs.Reports("Gauges").Fields(0).ColumnName = columnToDecrypt) Then
312
- ' Decrypt ds.Tables[0].Columns[0]
313
- ' ...
314
- End If
315
- End If
316
-End Sub
317
-```
... ...
\ No newline at end of file
0
+Due to the nature of the way the bulk CSV export runs, the above methods will not work for this type of export. In order to handle bulk CSV data, use the [[ProcessDataRow|ProcessDataRow]] override instead. You can learn more about the ProcessDataRow method by clicking the link.
... ...
\ No newline at end of file