StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Database Deployment Toolkit
»
Issues
»
Filtering Date in BO
Filtering Date in BO
Post Reply
Like
2
Filtering Date in BO
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Danny Doobay
Danny Doobay
posted 7 Years Ago
ANSWER
Topic Details
Share Topic
Group: StrataFrame Users
Posts: 40,
Visits: 333
I have three properties in my customers BO. The first one cust_DateofBirth with a data type of DateTime and it is mapped to database datetime field. Other two are custom field property and they are defined in the BO as follows
<ComponentModel.Browsable(False), _
MicroFour.StrataFrame.UI.Windows.Forms.BusinessFieldDisplayInEditor(), _
ComponentModel.Description("DOBGMT"), _
ComponentModel.DesignerSerializationVisibility(ComponentModel.DesignerSerializationVisibility.Hidden)> _
Public Property DOBGMT() As Date
Get
Return DatePart(DateInterval.Year, Me.cust_DateofBirth).ToString & "-" & DatePart(DateInterval.Month, Me.cust_DateofBirth).ToString & "-" & DatePart(DateInterval.Day, Me.cust_DateofBirth).ToString
End Get
Set(value As Date)
Me.cust_DateofBirth = value
End Set
End Property
<ComponentModel.Browsable(False), _
MicroFour.StrataFrame.UI.Windows.Forms.BusinessFieldDisplayInEditor(), _
ComponentModel.Description("DOByyyyMMdd"), _
ComponentModel.DesignerSerializationVisibility(ComponentModel.DesignerSerializationVisibility.Hidden)> _
Public ReadOnly Property DOByyyyMMdd() As String
Get
Return cust_DateofBirth.ToString("yyyy-MM-dd")
End Get
End Property
Protected Overrides Function GetCustomBindablePropertyDescriptors() As MicroFour.StrataFrame.Business.FieldPropertyDescriptor()
'-- Establish Locals
Dim r As New List(Of FieldPropertyDescriptor)
'-- Include all of the base descriptors
Try
r.AddRange(MyBase.GetCustomBindablePropertyDescriptors())
Catch ex As Exception
End Try
'-- Add the custom descriptors
r.Add(New ReflectionPropertyDescriptor("DOBGMT", GetType(CustomersBO)))
r.Add(New ReflectionPropertyDescriptor("DOByyyyMMdd", GetType(CustomersBO)))
'-- Return results
Return r.ToArray()
End Function
Private Sub CustomersBO_CurrentDataTableInitialized() Handles Me.CurrentDataTableInitialized
If Me.CurrentDataTable.Columns.Contains("DOBGMT") = False Then
Me.CurrentDataTable.Columns.Add("DOBGMT", GetType(Date))
End If
If Me.CurrentDataTable.Columns.Contains("DOByyyyMMdd") = False Then
Me.CurrentDataTable.Columns.Add("DOByyyyMMdd", System.Type.GetType("System.String"))
End If
End Sub
Private Sub CustomersBO_CurrentDataTableRefilled() Handles Me.CurrentDataTableRefilled
If Me.CurrentDataTable.Columns.Contains("DOBGMT") = False Then
'Me.CurrentDataTable.Columns.Add("DOBGMT", System.Type.GetType("System.Date"))
Me.CurrentDataTable.Columns.Add("DOBGMT", GetType(Date))
End If
If Me.CurrentDataTable.Columns.Contains("DOByyyyMMdd") = False Then
Me.CurrentDataTable.Columns.Add("DOByyyyMMdd", System.Type.GetType("System.String"))
End If
End Sub
Now when I tried to filter the BO using all three column option I am not getting the result (I have one record in SQL database)
CustomersBO.Filter = "cust_FirstName = 'John' AND cust_LastName = 'Smith' AND DOBGMT = '1962-09-19'"
CustomersBO.Filter = "cust_FirstName = 'John' AND cust_LastName = 'Smith' AND DOByyyyMMdd = '1962-09-19'"
CustomersBO.Filter = "cust_FirstName = 'John' AND cust_LastName = 'Smith' AND cust_DateofBirth = '1962-09-19'"
I tried to use CurrentDataTable with select statement and no result as well
?CustomersBO.CurrentDataTable.[Select]("cust_FirstName = 'John' AND cust_LastName = 'Smith' AND DOBGMT = '1962-09-19'").Length
0
?CustomersBO.CurrentDataTable.[Select]("cust_FirstName = 'John' AND cust_LastName = 'Smith' AND DOByyyyMMdd = '1962-09-19'").Length
0
?CustomersBO.CurrentDataTable.[Select]("cust_FirstName = 'John' AND cust_LastName = 'Smith' AND cust_DateofBirth = '1962-09-19'").Length
0
But when I just use first and last names it is fine in both occasion
CustomersBO.Filter = "cust_FirstName = 'John' AND cust_LastName = 'Smith'"
?CustomersBO.CurrentDataTable.[Select]("cust_FirstName = 'John' AND cust_LastName = 'Smith'").Length
1
Any help is appreciated.
Tags
BO
Filter
Edited
7 Years Ago by
Danny Doobay
Reply
Like
2
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
Filtering Date in BO
Danny Doobay
-
7 Years Ago
You can go about this a number of different ways. First, you could use...
Trent L. Taylor
-
7 Years Ago
Here is the project. Thought this would be easier.
Trent L. Taylor
-
7 Years Ago
Thanks for the reply. I have tested out something similar and it...
Danny Doobay
-
7 Years Ago
by the way this is related to SF version 1.7.7.1
Danny Doobay
-
7 Years Ago
Post Reply
Like
2
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search