I am currently working on a project in C# and use MySql as database. I am currently having a problem with creating a custom DataTable I want to show in my Report.
Extra Info : A test can have any no combinations of Cells & Valves for a test
But for one test it uses set range of Vales and Cells are predefined before each test.
Results Table (Sample)
TestID | CellID | ValveID | OutputValue1| OutputValue2 |
1 | 1 | 1 | 2.5 | 0.12 |
1 | 1 | 1 | 2.5 | 0.12 |
1 | 1 | 2 | 2.8 | 0.13 |
1 | 2 | 1 | 3.2 | 0.12 |
1 | 2 | 2 | 3.5 | 0.12 |
1 | 2 | 4 | 4.1 | 0.14 |
So for a example Valve 3 is not tested at this particular example. But can use if wanted.
Basically my table rows are dynamically need generate based on this results table.
Report Expected
Test ID = 1
Valves
| 1 | 2 | 4 |
CellID |Out1 | Out2| Out1| Out2|Out1 | Out2|
1 | 2.5 | 0.12| 2.8 | 0.13| 2.9 | 0.12|
2 | 3.2 | 0.12| 3.5 | 0.12| 4.1 | 0.14|
Out1 = OutputValue1
Out2 = OutputValue2
Can any one help me by direct me to a good link or explanation how to get this kind dynamic Data Table
Try this sql code. I have recreated a dummy table resembling your original table. There is a UDF that needs to be created as well. The remaining code can go in as a part of stored proc.
What it does is it returns a semicolon-separated values of output values for each valveid.
Of course in the front end, you’ll have to write code that identifies valveid as the number between a semicolon (;) and a hash(#).
Here is the output that the above SQL produces: