T O P I C R E V I E W |
ovince |
Posted - 10/08/2006 : 5:09:05 PM hi All,
I have a worksheet "wks" with 2 columns. I have read out these columns into datasets A and B.
I would like to create 2 datasets ("D1" and "D2") from A in a such a way that D1 contains rows of A under condition B<4.5 and D2 to contain rows of A under condition B>4.5. I have started in this way but it does not work
Dataset A(wks, 0); Dataset B(wks, 1);
Dataset D1; Dataset D2; int n; n= A.GetSize(); int count1=0; int count2=0; for(int ii = 0; ii<n; ii++) { if (B[ii] < 4.5) { D1.Add(A[ii]); count1++; } else { D2.Add(A[ii]); count2++; } } Why this does not work? And how to make realisation of this idea simpier?
Thanks Oliver |
1 L A T E S T R E P L I E S (Newest First) |
rlewis |
Posted - 10/08/2006 : 7:10:32 PM Your code fails because the declarations "Dataset D1; Dataset D2;" do NOT create valid dataset objects. The simplest solution is to add the lines " D1.Create(0,1); D2.Create(0,1);" after declaring D1 and D2 as dataset objects. |
|
|