BO.CopyDataFrom...?


Author
Message
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,



Does the BO.CopyDataFrom supports the BO's Custom Field Properties? I don't think so, but I wanted to ask anyway.



I am working on form which has a ChildFormDialog, and the BO has some Custom Field Properties that are filled from a store procedure, when calling the childFormDialog, the CFP does not exist in there, even though the BO is properly translated.



For now I solved by simply re-loading the data from the server in the ChildFormResults.

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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 Smile ):

- 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!
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Greg McGuffey (09/03/2009)
Not sure if I'm on the right track, but it might spark some better idea along the way!




First, thanks for taking the time to check the source code. I am currently trying to meet a deadline and adding quick fixes to review them later.



In short what happened is that I had created the CFP for the ListView to show some calculated fields, now I am creating reports and there are several thousand records in most of them and the CFP slowed down the process, so I decided to add those fields in the store procedure to load them faster which works, but then I wanted to use those same CFP in the ListViews and was hit with the surprise.



So far I quick fixed by having 2 CFPs one for the Report and one for the ListView, not completely efficient but that will buy me some time.




Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
If the custom property represents a field within the CurrentDataTable, then yes, it will be copied when you copy it over using the data table overload (actually either overload should work).  But if your custom property is pulling from some other location, then no, it would not be included.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search