How to specify values for date variables?

nwgarside

Member²
I'm using DOA 4.0.7.1 with CodeGear Delphi 2007 for Win32 (v11.0.2804.9245).

My TOracleDataSet's SQL looks like this:

SELECT * FROM refunds_mv
WHERE loginfo_insdate BETWEEN TRUNC(:p_range_start) AND TRUNC(:p_range_end)
ORDER BY loginfo_insdate ASC

The loginfo_insdate column is datatype DATE so I have declared my two variables (:p_range_start and :p_range_end) as type 'Date' in the DOA Variables Editor window. However, when I try and specify a value for these variables I always receive the error 'Error converting value' when the 'Value' edit box loses focus. I've tried entering '21-Oct-2007', '21-10-2007', '21/10/2007', and a few variations on these, but the 'Error converting value' error always occurs.

The odd thing is that I've managed to set the variables in the past, as when I open the DOA Variables Editor window both variables have a value (in the format 'dd-Mon-yyyy'). However, if I overtype the existing values (even with exactly the same as what's already there) the 'Error converting value' error occurs!

How therefore do I specify the values for data variables?

Kind regards,

Neil Garside
 
The SetVariable procedure will accept formal date values (TDateTime), so there is no confusion about the format.

Make sure that the variable is really declared as a date though, otherwise implicit conversions will occur.
 
Hi Marco,

Thanks for the prompt reply. I'm aware of the SetVariable procedure, but I'm wanting to set the variables' value at design-time (so the dataset can be made active at design-time).

So, how do I set the variables' value using DOA's Variables Editor window at design-time?

Kind regards,

Neil W. Garside
 
You need to supply the date in the windows date format, as defined in the Windows Regional and Language Settings. I did a little test and it seems to work fine.
 
Hi Marco,

Thanks again for the prompt reply. In my Control Panel > Regional and Language Options I have the following settings:

Short Date Format: dd-MMM-yyyy (sample: 15-Nov-2007)
Long Date Format: dddd dd MMMM yyyy (sample: Thursday 15 November 2007)

I've tried putting both sample values into the DOA Variables Editor window, but the 'Error converting value' error still occurs!

I can upload some screenshots if you can provide me an e-mail address to which to send them to?

Kind regards,

Neil W. Garside
 
Hi Marco,

A-ha! I just tried specifying the variables' value in the default Windows short date format 'DD-MM-YYYY', (e.g., '15-11-2007') and the 'Error converting values' error did not occur!

I'm sure I tried that format before my original posting! Anyhow, it's now fixed.

Thanks for your assistance!

Neil W. Garside
 
Back
Top