Page 1 of 2

LocateEx with lxNearest problem with dates

Posted: Thu 20 Aug 2009 13:20
by NoComprende
Doesn't work properly with dates e.g. if I search for the nearest to the 30/12/2001 it lands on 31/01/1995 when it should land on 01/01/2002 (there's no 30th or 31st of Dec 2001 in the table). It seems to be working in alphabetical order according to the date format.

Posted: Thu 20 Aug 2009 14:25
by NoComprende
Also if AnsiString S="31/12/2001" then
MyQuery->FindNearest(OPENARRAY(TVarRec, (S)));

does nothing. In fact I can't even get it to work on a string field.

Posted: Wed 26 Aug 2009 07:37
by NoComprende
Is this question too hard?

Posted: Fri 28 Aug 2009 10:21
by Dimon
I could not reproduce the problem.
Please send me a complete small sample to dmitryg*devart*com to demonstrate it, including a script to create and fill table.
Also supply me the following information:
- the exact version of MyDAC. You can see it in the About sheet of TMyConnection Editor;
- the exact version of your IDE.

Posted: Fri 28 Aug 2009 12:17
by NoComprende
CREATE TABLE `Dates` (
`ADate` DATE NOT NULL,
PRIMARY KEY (`ADate`)
);

insert into Dates values (20070707), (20080101), (20090101);

Put a TMyQuery (SQL->Text = "select * from Dates") or TMyTable (Table="Dates") on to a C++ Builder form or DataModule, set IndexFieldNames = "ADate", set Active = true then link the following code to a TButton, put a breakpoint on line 1 and a Watch on Dates->RecNo.

Dates->LocateEx("ADate","31/12/2008",TLocateExOptions()LocateEx("ADate","20081231",TLocateExOptions()<<lxNearest);

After execution of line 1 the RecNo is still 1 and nothing changes when executing Line 2.

I'm using rad studio 2009 and MyDAC 5.70.0.43. I'd pay to update to the latest version of MyDAC if there was an easy way of doing so and of finding the newest version. You did say you were going to rectify the mess that is called the 'registered users area' which has so many different addresses and passwords (which don't even show the latest version or when the subscription is up) but I've heard no word on that.

Posted: Fri 28 Aug 2009 12:42
by NoComprende
Note

Dates->LocateEx("ADate","01/01/2009",TLocateExOptions()LocateEx("ADate","01/01/2009",TLocateExOptions());

does move the cursor to record 3.

Also note

Dates->LocateEx("ADate","20091231",TLocateExOptions()LocateEx("ADate","20091231",TLocateExOptions());

raises a 'not a valid date' exception.

My windows date settings are in the dd/mm/yyyy format.

Posted: Mon 31 Aug 2009 08:40
by Dimon
The point is that when you use the lxNearest location option, the compared values have the same type as the KeyValues parametes does. In your case values are compared in text format. Therefore the search is done unpredictably.
To solve this problem you should specify the parameter type equal to the date type, like this:

Code: Select all

Dates->LocateEx("ADate", StrToDate("31/12/2008"),TLocateExOptions()<<lxNearest);

Posted: Mon 31 Aug 2009 10:27
by NoComprende
Thanks Dimon. it now works.

Has there been any movement towards having a Registered Members Area instead of a Registered Members Areas?

Posted: Mon 31 Aug 2009 12:58
by Devart
Sorry for the inconvenience, but we have not modified our Registered Users' Area yet.

To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)

Posted: Mon 31 Aug 2009 13:34
by NoComprende
Devart wrote:Sorry for the inconvenience, but we have not modified our Registered Users' Area yet.

To learn if your Subscription has expired, please contact our sales department (sales*devart.com).
If your Subscription has expired, you can renew it on the Ordering page (http://www.devart.com/mydac/ordering.html)
This is what my previous diatribe on the 'Registered Users Area(s)' was all about Dimon. I only know my subscription has expired and what edition I subscribed to because I kept the email you sent 18 months ago. When I tried to upgrade my MYDAC version last year and was unable to do so I was told my subscription must have ran out even though it had 3 months to run. You have some great products at Devart but having parallel users areas spread all over the web (that contain no details on when subscriptions run out) with different passwords and versions attached does devart or us no favours.

Posted: Mon 31 Aug 2009 13:57
by NoComprende
I've went to the ordering page and when I clicked on 'Professional Edition Subscription' I'm asked if I want to also order dbForge Studio with a 30% discount for an additional £94.23 which I was tempted to do but I then noticed I get a copy of dbForge Studio if I take the Professional to Developer upgrade at £33.63. Am I missing something or was I nearly ripped off for £60?

dbForge Fusion vs dbForge Studio

Posted: Tue 01 Sep 2009 15:20
by Devart
With MyDAC Developer Edition you get dbForge Fusion for MySQL. dbForge Fusion for MySQL is an add-in designed to simplify MySQL database development and enhance data management capabilities. You can integrate dbForge Fusion for MySQL into Microsoft Visual Studio or CodeGear RAD Studio. It serves for exploring and maintaining existing databases, designing compound SQL statements and queries, and manipulating data in different ways.

dbForge Studio for MySQL is an administration tool and development environment for working with MySQL databases. It serves for exploring databases, managing schema objects, setting user accounts and privileges, developing stored routines, and synchronizing data between databases.

Posted: Tue 01 Sep 2009 16:08
by NoComprende
My apologies. I have renewed and upgraded my subscription.

Posted: Thu 03 Sep 2009 10:37
by NoComprende
Dimon, do I have to uninstall the old version of MYDAC before installing the new one? If so, do I uninstall the components through the rad studio 2009 IDE or through control panel? My OS is Vista.

Posted: Thu 03 Sep 2009 12:10
by Dimon
I should uninstall the MyDAC components through Control Panel.