FAQ/ProcessDataSet.md
... ...
@@ -29,27 +29,25 @@ Without any post-processing we have the following report:
29 29
30 30
Now let's add some extra code to the CustomAdHocConfig class:
31 31
32
+###C♯
33
+
32 34
```csharp
33 35
public override void ProcessDataSet(DataSet ds, string reportPart)
34 36
{
35 37
// We want to alter only "Detail" part of the report set
36
- if (reportPart == "Detail")
37
- {
38
- if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
39
- {
38
+ if (reportPart == "Detail") {
39
+ if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) {
40 40
// Iterate through columns to find column with name "Ship Region"
41
- for (int index = 0; index < ds.Tables[0].Columns.Count; index++)
42
- {
43
- if (ds.Tables[0].Columns[index].ColumnName == "Ship Region")
44
- {
45
- foreach (DataRow row in ds.Tables[0].Rows)
46
- {
41
+ for (int index = 0; index < ds.Tables[0].Columns.Count; index++) {
42
+ if (ds.Tables[0].Columns[index].ColumnName == "Ship Region") {
43
+ // Iterate through rows to find the field with a value of "CA"
44
+ foreach (DataRow row in ds.Tables[0].Rows) {
47 45
if (row[index].ToString() == "CA")
48
- row[index] = "California";
49
- }
46
+ row[index] = "California";
47
+ }
50 48
// There can be only one column with a specific name,
51 49
// so we can leave the cycle as soon as we find it
52
- break;
50
+ break;
53 51
}
54 52
}
55 53
}
... ...
@@ -57,6 +55,8 @@ public override void ProcessDataSet(DataSet ds, string reportPart)
57 55
}
58 56
```
59 57
58
+###VB.NET
59
+
60 60
```visualbasic
61 61
Public Overrides Sub ProcessDataSet(ByVal ds As DataSet, ByVal reportPart As String)
62 62
'We want to alter only "Detail" part of the report set
... ...
@@ -66,20 +66,19 @@ Public Overrides Sub ProcessDataSet(ByVal ds As DataSet, ByVal reportPart As Str
66 66
For index As Integer = 0 to ds.Tables(0).Columns.Count - 1
67 67
If ds.Tables(0).Columns(index).ColumnName = "Ship Region" Then
68 68
For Each row As DataRow In ds.Tables(0).Rows
69
- If row(index).ToString() = "CA" Then
70
- row(index) = "California"
71
- 'There can be only one column with a specific name,
72
- 'so we can leave the cycle as soon as we find it
73
- break;
74
- End If
69
+ If row(index).ToString() = "CA" Then row(index) = "California"
75 70
Next
71
+ 'There can be only one column with a specific name,
72
+ 'so we can leave the cycle as soon as we find it
73
+ break;
76 74
End If
77 75
Next
78 76
End If
79 77
End If
80 78
End Sub
81 79
```
82
-And after implementing post-prosessor the result will be:
80
+
81
+When we run our post-processor code we will get the expected result:
83 82
84 83
![After Post-Processing](http://www.izenda.com/Site/KB/Uploads/Images/PostProcess_after.png)
85 84