Hi,
I have a webservice with the following fields,
<moduleno>M17AB
<fpono>818-1700-E
<process>SEWING
<Style>98966/ 1132e03817</Style>
<colour>Black (54A2)
<qty>1560
<requireddate>30 Aug 2013
<requestedno>GDI-RMWH-23401
<wh>RMWH
I need to have table transposed and the FPONo, to apear as the follwoing grid,
DAY | MOD 1 | MOD 2 | MOD 3 | MOD 4 | MOD 5 | MOD 6 | MOD 7 | MOD 8 | MOD 9 | MOD 10 | MOD 11 | MOD 12 | MOD 13 | MOD 14 | MOD 15 | MOD 16 | MOD 17 | MOD 18 | MOD 19 | MOD 20 |
01-Apr | 1056A | | | | | | | | | | | | | | | | | | | |
02-Apr | | 1076H | | | | | | | | | | | | | | | | | | |
03-Apr | 1064D | 1025C | | | | | | | | | | | | | | | | | | |
| | 1025D | | | | | | | | | | | | | | | | | | |
04-Apr | 1064E | | | | | | | | | | | | | | | | | | | |
05-Apr | | 1025F | | | | | | | | | | | | | | | | | | |
06-Apr | 1077A | | | | | | | | | | | | | | | | | | | |
07-Apr | 1026B | | | | | | | | | | | | | | | | | | | |
08-Apr | | | | | | | | | | | | | | | | | | | | |
tried the following but still cant get it working,
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim objWebService1 As New ServiceReference2.ServiceSoapClient("ServiceSoap1")
ds = objWebService1.GetFPPOGDIForDashboard("UN", "PW", "com")
Dim objDv As New DataView(ds.Tables(0), "Process='SEWING'", "ModuleNo", DataViewRowState.CurrentRows)
Dim test As New DataView(objDv.ToTable, "WH='RMWH'", "ModuleNo", DataViewRowState.CurrentRows)
GridView1.DataSource = GenerateTransposedTable(test.ToTable)
GridView1.DataBind()
GridView1.AllowSorting = True
Response.AppendHeader("Refresh", "360")
End Sub
Private Function GenerateTransposedTable(inputTable As DataTable) As DataTable
Dim outputTable As New DataTable()
outputTable.Columns.Add(inputTable.Columns(0).ColumnName.ToString())
For Each inRow As DataRow In inputTable.Rows
Dim newColName As String = inRow(0).ToString()
Try
outputTable.Columns.Add(newColName)
Catch ex As Exception
End Try
Next
outputTable.Columns(0).ColumnName = " Date "
For rCount As Integer = 1 To inputTable.Rows.Count
Dim newRow As DataRow = outputTable.NewRow()
newRow(0) = inputTable.Rows(rCount - 1).Item(6).ToString()
For cCount As Integer = 1 To outputTable.Columns.Count
For rCount1 As Integer = 1 To inputTable.Rows.Count
If outputTable.Columns(cCount - 1).ToString = inputTable.Rows(rCount1 - 1).Item(0).ToString Then
newRow(cCount - 1) = inputTable.Rows(rCount1 - 1).Item(1).ToString
End If
Next
Next
outputTable.Rows.Add(newRow)
Next
Return outputTable
End Function
please do let me know how to get this done
thanks in advance.