By Alex Luyando - 8/11/2009
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
|
By Alex Luyando - 8/11/2009
oh, and...
4.) How can a "view-only" column be introduced into the BD's listView?
Thanks again.
|
By Trent L. Taylor - 8/13/2009
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.
|
By Alex Luyando - 8/17/2009
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.
|
By Trent L. Taylor - 8/20/2009
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!
|
By Alex Luyando - 8/20/2009
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
|
By Trent L. Taylor - 8/24/2009
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.
|
By Alex Luyando - 8/24/2009
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.
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!
|
By Edhy Rijo - 8/24/2009
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.
|
By Trent L. Taylor - 8/25/2009
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   , '') 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   , '') 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.
|
By Larry Caylor - 8/25/2009
I downloaded and installed v_1.7.0.2 and it works great. I'd been setting all my view specific fields in code since I was never sure exactly what the designer was doing. Thanks for the fix
|
By Trent L. Taylor - 8/26/2009
No problem....I have a list of other things that you have requested that will most likely make it into a near point release as well. If you were using the override features this was a bit annoying....so it was higher on the list!
|
By Alex Luyando - 8/26/2009
Trent -
Installed the 1.7.0.2 update; no change (not that we expected any). I will work on setting up the StrataFlix database and testing the sample application this evening.
In the meanwhile it occurred to me that throughout this I have never posted the exception details, so I am including it here fwiw.
Thanks.
_____________________________________________________
IndexOutOfRangeException
The given item name could not be evaluated. The item 'CompanyName' does not exist on the business object.
Source : MicroFour StrataFrame Business
Stack Trace:
at MicroFour.StrataFrame.Business.BusinessLayer.GetDescriptor(String FieldName)
at MicroFour.StrataFrame.Business.BusinessLayer.get_Item(String FieldName)
at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.CreateListViewItem()
at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.LoadBrowseResults()
at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.ExecuteSearch()
at MicroFour.StrataFrame.UI.Windows.Forms.BrowseDialogwindow.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.ContainerControl.ProcessCmdKey(Message& msg, Keys keyData)
at MicroFour.StrataFrame.UI.Windows.Forms.DateTimePicker.ProcessCmdKey(Message& msg, Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
|
By Trent L. Taylor - 8/27/2009
Ahhh...you are trying to put the column in the results, not the search!There is a new property called IgnoreTableMappingAndIncludeAllFieldsInResults (or something like that) on the BrowseDialog that will include any column that is part of the overriding table as part of the search results.
|
By Alex Luyando - 8/31/2009
Trent L. Taylor (08/27/2009) Ahhh...you are trying to put the column in the results, not the search!.
Movie Trivia Quote of the Day: "What we have here, is a failure to communicate."
I had been concerned that we were mixing Cowboys and Giants ) Thanks for the tip... the Company Name now appears in the BD's listivew... love it. Still have the "empty" DropDowns in the Search dialog for any search field that is a view-only (i.e., not part of the real BO), but I will try to not worry about that too much unless it creates a problem. (Maybe just a bit concerned as it seems to deviate from expected behavior).
|
By Trent L. Taylor - 8/31/2009
Still have the "empty" DropDowns in the Search dialog for any search field that is a view-only (i.e., not part of the real BO), but I will try to not worry about that too much unless it creates a problem. (Maybe just a bit concerned as it seems to deviate from expected behavior).
Have you downloaded 1.7.0.2 and then gone back into the editor to set the initial value? I fixed this in the most recent build to prevent this from happening.
|
By Alex Luyando - 8/31/2009
Trent -
I assume you mean set the default Search Style (not the Initial Search Value). That being the case, then yes (installed 1.7.0.2), and yes (went back into the dialogs and set the Search Style).
One of the things I had not done, however, was to change the Search Styles to something other than the default Equals (because, well, I wanted Equals to be the default). Doing that now (e.g., setting Search Styles to Begins With) resolves the "empty" DropDown Listbox issue. I think I can live with that, but let me know if you need additional information from me to troubleshoot this in case there's a tweak that's needed).
Thanks.
|
By Trent L. Taylor - 8/31/2009
I assume you mean set the default Search Style (not the Initial Search Value).
Yeah, sorry. It sounds like you went back in and did what I was suggesting anyway even through my poor post. Let me know if you have any other issues.
|
By Alex Luyando - 9/1/2009
No worries... it's all good.
|
|