rohan_rege
13th September 2002, 00:03
i am reading a field containing a date value from a ascii file
eg. of a value is 09011999

i have to insert this value into a table field having domain tfgld.date

i use the foll. to try to do it :


num.day = lval(bfdt(3;2))
num.month = lval(bfdt(1;2))
num.year = lval(bfdt(5;4))
tfgld998.bfdt = date.to.num(num.year, num.month, num.day)
where
bfdt contains the date in string format , as it is extracted from the ascii file i.e 09011999


when i run the session it gives a error

Error 205 OUT OF RANGE

i tried debugging .......and diff. ways of trying to achieve the same thing as above .but no luck

Regards,
Rohan

lbencic
13th September 2002, 00:20
Rohan -

For testing, can you make sure this is running/broken for just 1 record, and not a possible problem with record number x of 50? Try moving the commit to right after your update of a single record, and see if there is still an error on the first record, or if it comes up later.
In debug what are the following values, after their assign statements, for a record causing the error:
num.day
num.month
num.year
tfgld998.bfdt

Maybe one of the records is having a month higher than 12 or a day higher than the month allows - that may generate an 'out of range' error, not sure.

FYI - Rohan has already tried filling the date with date.num(), and it works fine. There does seem to be a problem with his date field or formatting, though the syntax seems correct. Any other suggestions welcome :)

Rohan - there is at least 1 other method (probably many) - using the inputstr.to.date you can give it the input string without conversion, and the date format. It should convert this to a Baan date, like the other functions. I don't use that one much myself, but it may work better in this situation.