HomeForum
Welcome, Guest

Problem with date field
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Problem with date field

Problem with date field 1 year, 2 months ago #2103

  • West
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Good morning,

I'm trying to do a simple test and replace for a date on an ODBC data source (Foxpro) and output to a MS SQL Server table. There are some dates in the source file of 30/12/1899 which I would like to replace with null values on the output.

Nothing appears to be working for me and I get blanks in the output each time. However, when I ask for a "Data Preview" I get the correct results (see attached).

When I use a "Mapped to" I get the correct results on the output. But if I leave the calculated field formula in, I get nothing in the output (ie - I have to physically delete the calculation for the mapped field to work.

I must be missing something in the coding....please let me know what I should be using for this....thanks

I've also tried:

Iif(RightString("[PROSDATE]",4)=="1899","","[PROSDATE]") which gives the same results as the Date and DateS functions.

No Output:

Iif(YearS("[PROSDATE]","DD/MM/YYYY")=="1899","","[PROSDATE]")

Iif(YearS("[PROSDATE]","DD/MM/YYYY")=="1899","01/01/2010","[PROSDATE]")

YearS('[PROSDATE]','DD/MM/YYYY')

Works OK:

YearS('30/12/2009','DD/MM/YYYY')


Thanks,
West

Re: Problem with date field 1 year, 2 months ago #2104

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2191
  • Karma: 12
You are using sightly outdated syntax.

Try this one

Iif(YearS([ORDERDATE],'YYYY-MM-DD')='1899','',[ORDERDATE])

John
  • Page:
  • 1
Time to create page: 0.16 seconds

Testimonials

We were able to validate more data in less time when we started using Advanced ETL Processor

N.Chad
IT Manager

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top