Working with Browsedialog with view


Author
Message
Doron Farber
Doron Farber
StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)
Group: Forum Members
Posts: 92, Visits: 612
Hi Trent,



I found this link at: http://forum.strataframe.net/Topic23458-7-1.aspx?Highlight=browsedialog+with+view



I tried to implement it and so far it does not work for me.Wink



Reading the below I was not sure where do I add the fields that do not exits in the mainBO.

I will also add the search fields even though they do not exist as part of the original table structure:




Like in my BO I have 2 FKs like: SearchOptions_FK and SearchCategories_FK and need to add the actual description fields for those FKs some where. Also the Result I have some more FKs that is needed to be shown as well.



The View name is: Get_Products_MenuOptions_View and main table for that form is: ProductsMGR



I appreciate some clarifications in that matter.



Thanks,



Doron

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
Doron,



Before you get too deep, first, just create a view that returns all of the same columns and attach it and see it the browse still works. If so, then let's go from there.



This feature simply allows you to create a query that returns all rows (perform joins etc.) that can be searched on within the view results. But you will want to make sure that the BO pulling the result set still includes any fields associated with that table that are being referenced. Try the first step from above and see if you can at least query the exact same results that the BO table pulls.



For example:



SELECT * FROM MyTable

Doron Farber
Doron Farber
StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)
Group: Forum Members
Posts: 92, Visits: 612
Hi Trent,

Thanks for your reply.

I have done the below already before, and let me explain what I have done.

Before you get too deep, first, just create a view that returns all of the same columns and attach it and see it the browse still works. If so, then let's go from there.

BrowseResultLayout - All fields needed from the ProductsMGRBO (mainBO)
BusinessObjectToPopulate - ProductsMGRBO1 (main biz object)
BusinessObjectTipe -   ProductsMGRBO

OverRideSearchTableName - Get_Products_MenuOptions_View1
OverRideSearchTableSchema - dbo

SearchFields - Need to place the SearchCategory and SearchOption fields which are part of the view and also in the Result Layout.

Here is the actual view name: Get_Products_MenuOptions_View

I am trying to search based of these fields:  SearchCategory and SearchOption(part of the view) while the FKs of those fields are in the main BO named: ProductsMGRBO. The ProductsMGR is the main BO.

SELECT
 dbo.ProductsMGR.ProductsMGR_PK,
 dbo.ProductsMGR.SearchOptions_FK,
 dbo.ProductsMGR.SearchCategories_FK,
 dbo.ProductsMGR.Products_FK,
 dbo.ProductsMGR.DisplayProdutOrder,
 dbo.ProductsMGR.DateTimeCreated,
 dbo.Products.ProductName,
 dbo.Products.Price,
 dbo.Products.OriginalPrice,
 dbo.Products.DiscountedPrice,
 dbo.Products.ProductNo,
 dbo.SearchCategories.SearchCategory,
 dbo.SearchOptions.SearchOption
FROM
 dbo.ProductsMGR
 LEFT OUTER JOIN dbo.Products ON (dbo.ProductsMGR.Products_FK = dbo.Products.Products_PK)
 LEFT OUTER JOIN dbo.SearchOptions ON (dbo.ProductsMGR.SearchOptions_FK = dbo.SearchOptions.SearchOptions_PK)
 LEFT OUTER JOIN dbo.SearchCategories ON (dbo.ProductsMGR.SearchCategories_FK = dbo.SearchCategories.SearchCategories_PK)

Now how do I add the other fields from the view.  Please provide some steps.

Thanks,

Doron



 


 

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
Well, the first red flag that I see is that you are using LEFT JOINs and then not COALESCEing anything from those JOINs. This can produce an error. If you look at the sample that you referenced that I added, I avoided using the LEFT JOIN and placed all logic within inline SELECTs. You don't necessarily have to do this, but if you are going to use LEFT JOINs, you MUST take any type of NULL value into account. That is the first thing that I suggest you address.
Doron Farber
Doron Farber
StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)StrataFrame User (152 reputation)
Group: Forum Members
Posts: 92, Visits: 612
Hi Trent,



I download the sample app found at: http://forum.strataframe.net/Topic24160-6-1.aspx#bm24293 for the browse dialog and it is works fine on my computer. But in my scenario I can not make it to work.



I even tried a to test with a simple form as you did in your sample. When I had the fields name like: SearchOption and SearchCategory I still loose these names when looking into other fields in the combo box for Search Fields or the BrowseResultLayout. For the SearchOption and SearchCategory I have actually the FKs in that BO. If I type the names of those 2 fields and running the browse dialog I am getting this error as well: Object reference not set to an instance of an object.



If I had another field which is part of the BO then the browse dialog is loaded but those 2 fields SearchOption and SearchCategory are not shown.



This the main bo is named: ProductsMGRBO and it has the below fields:

ProductsMGR_PK

SearchOptions_FK

SearchCategories_FK

Products_FK

DisplayProdutOrder

DateTimeCreated



Actually me Edhy tried to make it work, but it just did not happen. Is there a view problem in here? See also attached data after running the view. If you look at the attached spread sheet there is no any NULL record. It is a straight forward data.Smile



The below view is based on a SP that I used all the time with no problem.

Here is the corrected view:



CREATE VIEW [dbo].[Get_Products_MenuOptions_View]

AS

SELECT

dbo.ProductsMGR.ProductsMGR_PK,

dbo.ProductsMGR.SearchOptions_FK,

dbo.ProductsMGR.SearchCategories_FK,

dbo.ProductsMGR.Products_FK,

dbo.ProductsMGR.DisplayProdutOrder,

dbo.ProductsMGR.DateTimeCreated,

dbo.Products.ProductName,

dbo.Products.Price,

dbo.Products.OriginalPrice,

dbo.Products.DiscountedPrice,

dbo.SearchCategories.SearchCategory,

dbo.SearchOptions.SearchOption,

dbo.Products.ProductNo,

COALESCE(dbo.Products.Percentage,'UNKNOWN') AS Percentage

FROM

dbo.ProductsMGR

INNER JOIN dbo.Products

ON dbo.ProductsMGR.Products_FK = dbo.Products.Products_PK

INNER JOIN dbo.SearchOptions

ON dbo.ProductsMGR.SearchOptions_FK = dbo.SearchOptions.SearchOptions_PK

INNER JOIN dbo.SearchCategories

ON dbo.ProductsMGR.SearchCategories_FK = dbo.SearchCategories.SearchCategories_PK

GO





Thanks,



Doron
Attachments
menu_options3.xls (96 views, 21.00 KB)
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
Thiw is somewhat hard to diagnose without actually having your data anb the environment setup.

On a small scale, outside of your application, can you make this work?  If you create a test project to setup this one thing, can you get it to work?

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