Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Hi Charles, Yes you are right, but in the BD I don't see how this could be done since the SELECT statement is done somewhere internally in which I don't see how we could hook up. I have used your trick several times specially when exporting to Excel and in fact the BO is very flexible allowing us to manipulate its datatable, but again I cannot find how this could be done from a BD.
Edhy Rijo
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Actually, one of the very cool things about BOs is that you can fill a BO will any data. It does not have to even be related to the table/view that was used to map the BO. Of course, things can get weird if you aren't careful when doing this. I use this in a few ways. I have fill methods that will fill the BO just for combo or list filling, filling only data actually needed in the list (name and ID sort of thing). I use it to fill BOs with denormalized data (i.e. load the name of FK record). Many times I'll create custom field properties to access these other columns. The trick is to understand that if you don't fill in a column that the BO is mapped to, if you access that column, you'll get an error.
The issue Edhy was having was that it appears that we don't have control over what is put into the select statement when using the BrowseDialog. Thus, if you have a table that includes some monster fields, the search can be slow. He's concluded that using a view is the way to go, so he can exclude those large fields and also include some denormalized fields. He then uses normal fill methods when he wants to populate the form with the result of the search (I think that's what's going on anyway).
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Greg McGuffey (03/11/2010) The issue Edhy was having was that it appears that we don't have control over what is put into the select statement when using the BrowseDialog. Thus, if you have a table that includes some monster fields, the search can be slow. He's concluded that using a view is the way to go, so he can exclude those large fields and also include some denormalized fields. He then uses normal fill methods when he wants to populate the form with the result of the search (I think that's what's going on anyway). Wow!!! either I did explain myself correctly or you are mind reader Greg Thanks for the clarification you are right on the spot. Of course by using the view and my approached and then will need to modify all the forms logic in which this BD is being used, not a big deal, but I would have preffered not to do so, but at the end, those forms will also benefit of having the denormalized fields instead of the nice Custom Fields Properties which I felt in love with when learning SF.
Edhy Rijo
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
okay, again I may not be thinking this throug, but my idea is to use two BOs, one for the BD and the one that will be filled from the result of the BD. On looking at the BD properties I guess the problem is that the BD will let you specify the BO but not the designate what fill method will be used ? ( seems a good ER that that be added to BD props to let you point to a BO Fill method or sproc )
And I take it that Override Schema won't have anything to do with this either ?
|
|
|
Greg McGuffey
|
|
Group: Forum Members
Posts: 2K,
Visits: 6.6K
|
Where's Override Schema? Is this an event or property or method?
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
OverrideSearchTableName
OverrideSearchTableSchema
Strataframe:Browse Data properties of the Browse Dialog
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
Here's the source that uses it in BrowseDialogWindow Public Function Search(ByVal WhereStatements As WhereStatementCollection, ByVal useOrNotAnd As Boolean, ByVal tokens As Dictionary(Of String, String)) As Integer
'-- Establish Locals
Dim lnReturn As Integer = 0
Dim loInfo As New QueryInformation()
'-- Build the query information
loInfo.QueryType = QueryTypeOptions.SELECT_TOP
loInfo.TopRowCount = Me._BrowseDialog.MaximumReturnedRecords
If String.IsNullOrEmpty(Me._BrowseDialog.OverrideSearchTableName) Then
loInfo.TableName = Me._BusinessObject.TableName
Else
loInfo.TableName = Me._BrowseDialog.OverrideSearchTableName
End If
If String.IsNullOrEmpty(Me._BrowseDialog.OverrideSearchTableSchema) Then
loInfo.TableSchema = Me._BusinessObject.TableSchema
Else
loInfo.TableSchema = Me._BrowseDialog.OverrideSearchTableSchema
End If
|
|
|
Charles R Hankey
|
|
Group: Forum Members
Posts: 524,
Visits: 30K
|
okay, on searching further here on the forum I get it - the "schema" refrerred to here is something like "dbo." not the structure of the data that will be returned.
Oh well.
So you can override the table, but that gets us back to using a view.
I'm thinking there is an ER in the works here. Shouldn't be that difficult to allow loinfo to pass in the fieldlist to the filldatatable()
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
Yes Charles, this refers to the database Schema not the fields, but I am sure there should be some trick to handle this other than using the view. I am still waiting for Trent to comment on this one.
Edhy Rijo
|
|
|
Edhy Rijo
|
|
Group: StrataFrame Users
Posts: 2.4K,
Visits: 23K
|
!!!Warning!!!! For anybody using the view approach the following steps most be done so it will work properly: 1.- In the BOM you must check "Override Primary Key Specification" in the BO Properties and select your PK field or fields used or when you select a record in the listview it will not have the correct PK value in the ListViewItem.Tag property. 2.- The BD property "ReturnSelectedRecordOnly" should be set to True so the correct record is copied the one in the BO assigned to the BD. I just spend an hour trying to find out why the selected record in the listview was not being copied to the assigned BO and I just forgot that the view had not PK field assigned in the BOM and this was causing the code in the ListView to failed without error and not finding the correct record.
Edhy Rijo
|
|
|