By Luiz Lima - 1/29/2010
Hi,I´ve read in the post below that Ed says about configure a CFP to shows. http://forum.strataframe.net/Topic17056-7-1.aspx I configured my CFP and implemented this code below, but BD does not show my field on list. ''' <summary>''' NOME DO VENDEDOR CUSTOM PROPERTY''' </summary>''' <remarks></remarks><Browsable( False), _BusinessFieldDisplayInEditor(), _ Description( "Nome do Vendedor"), _DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _ Public ReadOnly Property [GET_ven_nome]() As System.StringGetDim loCommand As New SqlClient.SqlCommand()'-- Build the commandloCommand.CommandText = "SELECT ven_nome from tb_vendedor where ven_cod = @ven_cod"'-- Create and set the parametersloCommand.Parameters.Add( "@ven_cod", SqlDbType.Int)loCommand.Parameters( "@ven_cod").Value = Me.ven_cod'-- Execute the query and return the valueReturn CType(Me.ExecuteScalar(loCommand), String)End GetEnd PropertySome help?
|
By Edhy Rijo - 1/29/2010
Luiz Lima (01/29/2010) I configured my CFP and implemented this code below, but BD does not show my field on list.
Hi Luiz,
Make sure you build your project or solution whenever making changes that will be use in a type editor like BD, or the property window.
|
By Luiz Lima - 1/29/2010
Edhy,I will check my project. Tel me.... Is my code correct? I don´t wanna work with view, this is very hard work to manage.. And about the performance and we work with CFP?
I made a test with BD populate event, oh Gosh... so slow.....
tks
|
By Edhy Rijo - 1/29/2010
Hi Luiz,
I don't see any problem with your code.
Now keep in mind that CFP could be an slow solution when you are returning many records because of the Scalar method being called per each record/row.
In case of many records, a view will be easier to manage and much more faster. If you use the SF DDT you can create your view definition in DDT and use the BO with the view to get the table structure correct.
There are many other approaches you can use. Do a search in the forum using the word "slow" and you will find many threads.
|
By Trent L. Taylor - 1/30/2010
Luiz,
Did you override the GetCustomBindablePropertyDescriptors and add your new property to the array returned there? If you have not done that, it will not show up within any binding segment of the code.
|
By Luiz Lima - 1/31/2010
Edhy
I´m still with the problem, but I was thinking.... it will be slow because the tables sometimes have thousand of records. Using view for me it´s a very hard work, imagine that I have 20 bd to handle? The whole process is:
- create a view with DDT - generate the BOs with BOM - make changes on BD after close event to copy the whole content of a view (not only one record) to PrimaryBo of the Form.
Very hard, insn´t it? I´ve tried to use copydatafrom() but it return errors because my View has more fields than BO Is there another way?
Tks
|
By Trent L. Taylor - 1/31/2010
Luiz,I am not sure what you are trying to accomplish at this point. But I know that the custom property will work if there is data to back it up. Also, is this a scenario where an incremental search could work for you? I posted a sample of how to perform a threaded incremental search today. You can find it here: http://forum.strataframe.net/FindPost25669.aspx
|
By Luiz Lima - 1/31/2010
Trent,
I read your post today before post my replies here, in a future I will implement incremental search with thread on my system, but at this point my problem is the time that I will spend to implement the change. Maybe BO View will be the solution, not simple to implement but faster than another.PS: Sorry by my english
Tks
|
By Edhy Rijo - 1/31/2010
Hi Luiz,
Let's clear one thing, are you able to see the CFP in the BD type editor? that would be the first thing to fix, then if so let see how to incorporate the data using a view or something else, but first let me know if you can see the CFP?
|
By Luiz Lima - 2/1/2010
Edhy,
First of all, I can´t see CFP in BD (Design Mode), it only shows fields from database table. I made a test with BD RowPopulate Event, gosh.. so slow.. I thought if CFP would work like that. If performance working almost like a Subquery. Ok... I will continue trying to use CFP.
What do you tell me?
Tks a lot
|
|
By Edhy Rijo - 2/1/2010
Hi Luiz,
Look again in the SF help on how to create a Custom Field Property, somewhere you have it wrong.
Here is a sample of several CFPs I have in one of my BO:
Protected Overrides Function GetCustomBindablePropertyDescriptors() As FieldPropertyDescriptor()
' Create and return a new array of FieldPropertyDescriptor objects that contains
' the ReflectionPropertyDescriptor for the Custom Fields.
Return New FieldPropertyDescriptor() _
{New ReflectionPropertyDescriptor("cfp_CardName", GetType(bizTransactionItems)), _
New ReflectionPropertyDescriptor("cfp_CardLotNumberWithPrefix", GetType(bizTransactionItems)), _
New ReflectionPropertyDescriptor("cfp_CardEndSerialNumber", GetType(bizTransactionItems)), _
New ReflectionPropertyDescriptor("cfp_CardDescription_ForListView", GetType(bizTransactionItems)), _
New ReflectionPropertyDescriptor("cfp_CardEndSerialNumber_ForListView", GetType(bizTransactionItems)), _
New ReflectionPropertyDescriptor("cfp_CardLotNumberWithPrefix_ForListView", GetType(bizTransactionItems))}
End Function
'''
''' Combines the CardLotNoPrefix with the CardLotNumber.
'''
'''
''' The Lot Number formatted with a prefix if not empty.
'''
BusinessFieldDisplayInEditor(), _
Description("Combines the CardLotNoPrefix with the CardLotNumber."), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Overridable ReadOnly Property [cfp_CardLotNumberWithPrefix_ForListView]() As String
Get
If _CardBOLookup.Count = 0 Then
_CardBOLookup.FillByActiveRecordsAndITemType(BusinessEditingState.Idle, bizItems.bizItemsFieldNames.ItemIsInactive.ToString, Enumerations.ItemType.CallingCard)
End If
If _CardBOLookup.Count > 0 AndAlso _CardBOLookup.SeekToPrimaryKey(Me.FK_Items) Then
If Not String.IsNullOrEmpty(_CardBOLookup.CardLotNoPrefix) Then
Return String.Format("{0}-{1}", _CardBOLookup.CardLotNoPrefix, Me.CardLotNo.Trim)
Else
Return Me.CardLotNo
End If
Else
Return Me.CardLotNo
End If
End Get
End Property
BusinessFieldDisplayInEditor(), _
Description("Card Lot Number with any Prefix if exist."), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public Overridable ReadOnly Property [cfp_CardLotNumberWithPrefix]() As String
Get
Return CType(Me.CurrentRow.Item("cfp_CardLotNumberWithPrefix"), System.String)
End Get
End Property
In the CFP definition you can have any code you want to return the proper value, or like in the case of "cfp_CardLotNumberWithPrefix" here you can simply return the column from the CurrentRow which is what I do when using a SELECT statement with a JOIN table to return the FK field description I need, so in reality you DO NOT NEED A VIEW, you can use a stored procedure to get the data for any BO and have any JOIN condition in your SP and then use a CFP like "cfp_CardLotNumberWithPrefix" and when the BO is filled, its data table will have that column "cfp_CardLotNumberWithPrefix" available which the CFP will read.
I know this could be confusing at first, but at the end is very simple and it works.
|
By Luiz Lima - 2/4/2010
Ed,Now it´s working, CFP appears on BD Editor. Tomorrow I will test the performance and I tell you ok?
The problem was solved with these imports inside BO file.
Imports MicroFour.StrataFrame.UI.Windows.Forms Imports System.ComponentModel
Tks a lot!
|
By Trent L. Taylor - 2/4/2010
Good to hear!
|
By Edhy Rijo - 2/4/2010
Hi Luiz,
Glad you are moving forward, you will be surprise how nice this is handle by SF
|
By Luiz Lima - 2/5/2010
Ed,
Tks a lot again... surprise? no man, i´m ecstically I came from Cobol, Delphi, Centura... but now.. SF... o GOSH!!!!! (Tks Trent!!!!!! :cool
Let´s come back to my problem..
1-) CFP was so slowly (I will implement view) 2-) There´s no way to search by CFP (the error is: The given key was not present in the dictionary), normal because the field does not exist in Sql table. 3-) I will implement a view to obtain performance, but I have problems with copy from BoView to FormBo because views has more columns than the original BO (boForm)
Can you help me?
Tks
|
By Trent L. Taylor - 2/5/2010
Luiz,The BrowseDialog control has two properties that allow you to override the table (or view in this case) that will be used to retrieve the records. They are the OverrideSearchTableName and OverrideSearchTableSchema (I think ). Anyway, these two properties allow you to query a view or another table. This feature gives you the ultimate flexibility in what to query server side including joining in tables, etc. I have posted a link below on the forum to a thread I think you should read as well as a sample that may help. http://forum.strataframe.net/FindPost24299.aspx
|
By Luiz Lima - 2/8/2010
Trent,
The overidetable property are available on version 1.6.6.0?Tks
|
By Ivan George Borges - 2/8/2010
Hi Luiz!You are sticking to an older version?
|
By Trent L. Taylor - 2/8/2010
I will have to go back and look to see what version that was implemented, but I would strongly suggest moving to 1.7.0.6. There have been many new features and fixes since 1.6.6!
|
By Luiz Lima - 2/8/2010
Ivan and Trent,
I should to move to new version but I have a lot of work to do in this moment, and also we use a USB NIC to share the same license Sincerly, I´m afraid to change to new version, if my project stop it? (please don´t laught... but in other framework, this is a reallity).
PS: Sorry again by my english... rsSee ya
|
By Luiz Lima - 2/11/2010
Guys,
I wanna move to the new version, but I´m afraid. Is there a possibility to get problems in some code implemented in my project?
We don´t use ChildForm, we use devexpress to edit on grid. We have almost 80 forms. We work with a lot of BD.
I hope some advise from you,
Tks
|
By Trent L. Taylor - 2/11/2010
Really the best option is to move forward. There is not any way for us to make a change on your existing version. The only other option is to try and implement something outside of the framework or possibly in a BrowseDialog information panel, which may meet your needs.
|
By Luiz Lima - 2/11/2010
Trent,
I will try to test the new version and see how the project works.
Tks a lot again
|