Solved

How to do a .Select() or set a rowfilter on a Dataset with "Right" function

Posted on 2007-03-27
4
684 Views
Last Modified: 2012-08-13
Goodday,
How can I do a select on a dataset table with the "Right" function on a string ?
Problem now is that the "Right" function is not usable in the rowfilter or a .Select()

Example :
ds.Tables("Overview").DefaultView.RowFilter = "right([Dates],4 = " & dat_year

The table in the dataset ds contains the column Dates in which text is stored like :
"01.01.2005 - 01.02.2005"   and I would like to do a select on the last 4 char.


0
Comment
Question by:RonaldZaal
  • 2
4 Comments
 
LVL 21

Expert Comment

by:tovvenki
ID: 18798618
HI,
instead of checking the year part check the date from 01/01/date_year till 31/01/date_year
startDate as string
endDate as string
startDate = "01/01/" & dat_year
endDate = "31/01/" & dat_year
ds.Tables("Overview").DefaultView.RowFilter = "[Dates] >= " & startDate & " and [Dates] <= " & endDate

I hope that this helps you


Kind Regards
Venki
0
 
LVL 2

Expert Comment

by:alfredwhang
ID: 18798837
try:

1) ds.Tables("Overview").DefaultView.RowFilter = "Date>=#01-01" & Yr & "# AND Date<#01-01" & Yr +1 & "#")

2) ds.RowFilter = "Convert(Date,'System.DateTime') =" & Yr

3) ds.Tables("Overview").DefaultView.RowFilter = "Year(Date) = " & Yr
0
 
LVL 2

Accepted Solution

by:
alfredwhang earned 500 total points
ID: 18798849
sorry:

don't forget the # in 1

and 2) should be:

ds.RowFilter = "(Convert(Date,'System.DateTime')).Year =" & Yr
0
 
LVL 5

Author Comment

by:RonaldZaal
ID: 18836534
To my surprise I left the Q without a note.
Better late then never I guess

Thanks alfredwhang !

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now