Edhy,
I just took a look at the source and it looks like it won't copy any CFP (depending on how you fill the CFP). What it does is copy the CurrentDataTable form one BO to another. However, how it does this is:
1. Calls NewRow on the destination BO. This will initialize a row in the DataTable with the known, standard columns as defined by the BO (i.e. no extra columns that might be used by CFP).
2. Loops through the rows of the source table and for each row loops though its columns.
3. For each of these columns, it then checks to see if the column exists in the destination table. If it does, it adds the data from the source to the destination, otherwise it skips to next column.
So, if you are loading CFP via extra columns from a fill (e.g. the fill method is looking up FK related data and putting it in an extra column), then this won't copy the data over for you. If the CFP actually went out themselves and got the data, then it wouldn't matter. The data wouldn't be in the data table in any case and it would be retrieved when needed. I'm not recommending this, just pointing out that it depends on how you fill your CFPs with data.
Couple of things that come to mind (likely you already figured this out, but in case others haven't
):
- When you fill a BO, the returned record set determines the columns in the underlying BO. I use this fact in two cases: when loading CFPs (adding extra columns to load the CFPs) and when filling a combo, listbox or listview (to limit the data pulled). In the first case, there are extra columns in the data table and in the second, there are fewer columns.
- When using NewRow on an empty/new BO, it will initialize the data table to have the rows defined by the BO...i.e. no extra ones.
What I'd be curious about is what happens when you call NewRow and the current data table already has the extra rows defined? I'm guessing that the new row would have all the columns (how couldn't it?). If that is the case, you might try initializing the BO in child form dialog to have the necessary extra columns, then call CopyDataFrom (if that's possible). You could add a method the BO that does this. You could either manually add the columns to the datatable or use a SQL statement that returned no data.
Not sure if I'm on the right track, but it might spark some better idea along the way!