OverrideSearchTableName


Author
Message
Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
Hi all -



First use of the OverrideSearchTableName feature from the latest SF beta... a few questions popping up.



1.) It appears you must have all the columns that are in the "real" business object (i.e., the BO mapped to the actual SQL table that will be the target of inserts/updates) in the view? Makes sense, since the BD will then use its data to populate the real BO. Have I got this correct?



2.) Looks like you must always override the DataType if you want the Search Fields to use a "view-only" column, yes? Before doing this got strange-looking results where the view-only column was in the list of Search Fields, but the BD would not honor my checking it to include it in the list of fields I could use to enter selection criteria.



3.) Any differences in the implementation of this feature between the last beta and the current production release? In the process of renewing our license and I don't want to build stuff with the latest beta that will need reworking once I am on the latest production build.



TIA

________________
_____/ Regards,
____/ al
Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
oh, and...



4.) How can a "view-only" column be introduced into the BD's listView?



Thanks again.

________________
_____/ Regards,
____/ al
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
1.) It appears you must have all the columns that are in the "real" business object (i.e., the BO mapped to the actual SQL table that will be the target of inserts/updates) in the view? Makes sense, since the BD will then use its data to populate the real BO. Have I got this correct?




Only if you are going to reference those columns. If not, then no. So if you have any column added as a search value or a display value that will be evaluated in any way, then you must include these columns.



2.) Looks like you must always override the DataType if you want the Search Fields to use a "view-only" column, yes? Before doing this got strange-looking results where the view-only column was in the list of Search Fields, but the BD would not honor my checking it to include it in the list of fields I could use to enter selection criteria.




Not necessarily. If the type coming back is the very same as the original type, then no. But depending on the query and how the data is coming back, then you may be required to cast this or set the data type.



3.) Any differences in the implementation of this feature between the last beta and the current production release? In the process of renewing our license and I don't want to build stuff with the latest beta that will need reworking once I am on the latest production build.




Should be the same.



4.) How can a "view-only" column be introduced into the BD's listView?




Just include the column in your query. If you want to have the ability to query, then you will need to create a custom property (just like you would for any other custom BO property) and you will be able to search on it. If it is for reference only, this approach would still work, but technically you should just be able to add the column (type it in versus selecting from list) and then it will pull from the result set.
Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
Trent L. Taylor (08/13/2009)
4.) How can a "view-only" column be introduced into the BD's listView?


Just include the column in your query. If you want to have the ability to query, then you will need to create a custom property (just like you would for any other custom BO property) and you will be able to search on it. If it is for reference only, this approach would still work, but technically you should just be able to add the column (type it in versus selecting from list) and then it will pull from the result set.


Hey Trent -



Ok, I must be missing something, as I am getting different (conflicting) behavior.



If you want to have the ability to query, then you will need to create a custom property (just like you would for any other custom BO property) and you will be able to search on it.


Actually, I am able to have the columns that only exist in the view as search columns in the Browse Dialog without the CFP! They do look a bit odd in that the Advanced Options DropDown initially has no default selected (e.g., Equals), but other than that they work. And, when I dropdown the Advanced Option for these columns I get the appropriate options for the (overridden) datatype I specified.



If it is for reference only, this approach would still work..


Now trying to add a Custom Field Property (in order to have a column that exists in the view only appear in the Browse Dialog's listview), thing fall apart very quickly. If I add the following to the main business object that's tied to a SQL Server table (i.e., not to the denormalized view that drives the BrowseDialog)..



[Browsable(false),

BusinessFieldDisplayInEditor(),

Description("CompanyName"),

DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

public System.String CompanyName

{

get

{

return this.CompanyName;

}

}




protected override FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()

{

return new FieldPropertyDescriptor[]

{

new ReflectionPropertyDescriptor("Validation_Status_Short_Description", typeof(boIRSComponentTransactions)) ,

new ReflectionPropertyDescriptor("CompanyName", typeof(boIRSComponentTransactions))

};

}




then try to add CompanyName to the BD's BrowseResultsLayout, I get the following error as soon as I try to execute a search on in the BD.



The given item name could not be evaluated. The item 'CompanyName' does not exist on the business object.





The code in the CFP seems wrong to me, but I don't see how to reference a column from the BD's internal datatable (i.e., from the view) in the main BO. When I first read your reply I thought you might be referring to adding the CFP to the BD's BO, but I don't see how that would be referenced (and it's just a datatable, not a BO). HELP!



, but technically you should just be able to add the column (type it in versus selecting from list) and then it will pull from the result set.


Tried this too, just typing CompanyName in the BrowseResultsLayout dialog, but got the same error as above.



By the way, have been running the last beta, but we just go the distribution files for 1.7.0.1 and will be installing shortly. Don't expect that to make a difference, but wanted to disclose it.



TIA.


________________
_____/ Regards,
____/ al
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
Alex,



I am sorry I have not gotten to this yet. I saw a novel and assumed it would take a few minutes to work through and I have been on the run all week. I am leaving town today and will be back in the office on Monday and will try to get you some answers. Again, I am sorry for the delay on this as this is not our standard response time (as I hope you already know). But there have been some personal issues going on around here that have had most of us out of the office that answer forum posts.



Again, I apologize and will get on this soon!
Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
Trent -



Here's an update on this on-going problem.



. I've installed 1.7.0.1 -- No change to the behavior

. I have three forms/BOs where I am OVERRIDESEARCHTABLENAMEing the BD... same issue in all three.

. The actual searches work (i.e., definitely using the view), but:



1.) Many of the Advanced Option dropdowns in the BD are blank when the BD is shown. See the attachment for an example.



2.) I cannot make a field that's in the view (and not in the main BO's table) part of the BD's listview... Attempting to type in the view's column name into the BrowseResultsLayout dialog still getting the error noted (at runtime) in my original post.



3.) The General Tab of the Search Field Criteria dialog will not update the allowed Search Style dropdown to reflect the data type specified in the Data Type tab (i.e., the overriden data type).



Any ideas on next steps I should try?



TIA


________________
_____/ Regards,
____/ al
Attachments
tmp.jpg (136 views, 53.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
1.) Many of the Advanced Option dropdowns in the BD are blank when the BD is shown. See the attachment for an example.

I have tested this a number of different ways to make sure that there was not a hole anywhere...and I think it is totally sound.  I did make a change to the editor that I will describe in a minute which could be your problem if you did not catch it.  But first let me just explain that this will work when setup properly:

And to setup, there is really nothing to do past providing a valid field name.  There could be something else set within the field editor that could cause an issue, so we may need to look at what else you have set.

Bug Fixed for version 1.7.0.2
There was a bug that when you go back into the search field editor for a custom field that doesn't have a custom property or normally belong to the BO.  Upon re-entry, the field name at the top of the editor dialog would be reset and no longer retain the custom field name from the view.  This has been fixed in 1.7.0.2, but if you do not change this back, it could cause you some issues.

2.) I cannot make a field that's in the view (and not in the main BO's table) part of the BD's listview... Attempting to type in the view's column name into the BrowseResultsLayout dialog still getting the error noted (at runtime) in my original post.

First, you are correct that you must type this in (unless you have created a custom property) for the results.  The bottom line is that the column in question must just be in the result set coming back.  I have tested this numerous different ways, and it is working correctly.  Both in test and production environments, so this will be related to your query or the field name that you typed in.  Double-check to make sure that the column exists in the result set and that it is typed correctly in the results list as well.

3.) The General Tab of the Search Field Criteria dialog will not update the allowed Search Style dropdown to reflect the data type specified in the Data Type tab (i.e., the overriden data type).

What data type are you expecting and how are you overwriting the data type?  This will default to a string if it cannot be determined, so I would be curious as to how you are trying to change the data type.

Alex Luyando
Alex Luyando
StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)StrataFrame User (210 reputation)
Group: StrataFrame Users
Posts: 112, Visits: 1.2K
Trent -



First of all, thanks for taking the time to look into this so deeply. I appreciate it.



Secondly, I just went through and created a new maintenance form complete with BD to retest the problem I am having. This time, I used pure StrataFrame base classes (i.e., not my intermediate layer classes that are derived from SF classes) just to see if something along the inheritance tree was causing issues. Same problems. Sad



As to your reply to my points…



If you're saying that under no circumstances the dropdowns should be empty, then clearly we have a problem as mine are.



Also, I tested the "typing in wrong column name" theory by copying the search field "CompanyName" that works (and which is based only on the view… it does not existing in the "real" business object) to the BrowseResultsLayout dialog. There I pasted it as a Field, as well as specifying the resulting index as a Column. Doing this generates the "The given item name could not be evaluated. The item 'CompanyName' does not exist on the business object." error at runtime as soon as I perform a search. Note that if I drop the CompanyName (the view field) from the browseResultsLayout I can search on CompanyName and the main BO get populated without issues. So, I am convinced I am typing the view's column name in correctly (since searching on it works great).



As for the setup of the BD I have specified the OverrideSearchTableName to be the view, set the OverrideSearchTableSchema to dbo (same as BO, so this was optional), and specified the BusinessObjectToPopulate to the BO on my maintenance form. Since I can do a search on the view's CompanyName column (so long as CompanyName is not in the BrowseResultsLayout), then click OK on the BD and have my maintenance form's BO populated, I am convinced there's no disconnect between the BO's table and the view (e.g., overriding the BD with a view based on some other non-related table).



In terms of overriding the data type I am accessing the Data Type tab in the Search Field Criteria dialog, checking the Override Data Type and specifying (in this case) String.



Don't know that the above gets us any closer to a resolution, but perhaps there are some clues you will be keen enough to pick up on. Is there anything else I can do/try that would help you help me?



By the way, doesn't look like 1.7.0.2 is in our account… guess it's not released yet?



Thanks!

________________
_____/ Regards,
____/ al
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,



I think for this one, it would be better if you can put together a small sample app or add this feature to the StrataFlix sample so we can look at its implementation.

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
OK, I have put SF 1.7.0.2 out in the My Account area and have made a few minor changes to the BrowseDialog. I may send out an email and post a news article later, but this should be ready to go. After you load the 1.7.0.2 build (I fixed some minor things to make life easier) then you will need to do the following to make this sample work. It uses the StrataFlix database, so make sure it is loaded. Once loaded, then execute this command on the StrataFlix database to create a view for this sample:



CREATE VIEW SampleBrowse

AS



SELECT

   MV.*,

   

   -- Get the top 1 cast member for the last name

   COALESCE(

   (

   SELECT TOP 1

      P.pl_LastName

   FROM MovieCast AS MC

      LEFT JOIN People AS P ON P.pl_pk = MC.mc_pl_pk

   WHERE MC.mc_mv_pk = MV.mv_pk

   Wink, '') AS CastLastName,

   

   -- Get the top 1 cast member for the first name

   COALESCE(

   (

   SELECT TOP 1

      P.pl_FirstName

   FROM MovieCast AS MC

      LEFT JOIN People AS P ON P.pl_pk = MC.mc_pl_pk

   WHERE MC.mc_mv_pk = MV.mv_pk

   Wink, '') AS CastFirstName

FROM Movies AS MV







Note: This query is not optimized so please don't post threads saying that the sample takes 10 seconds to being back a result set. I was not trying to create an optimized query, just one easy to understand without creating new indexes, etc.



After this is done, then the sample should work.

Attachments
CustomViewBrowseDialogSample.zip (152 views, 85.00 KB)
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