Question

How to compare date field to system date; omit records with dates "less than" today's date?

  • 27 January 2015
  • 3 replies
  • 17 views

I have a few tables that I am converting from Oracle Spatial to Google Maps Engine (GME) tables. There is a field, called "DISCONTINUEDATE", which has the end dates for certain projects. Rather than delete the records whose DISCONTINUEDATE's are prior to today, I'd like to omit them from the data being published with GME.

 

 

So far I'm using the TimeStamper transformer to create a "SYSDATE" field with today's date. I'm having trouble using a Tester to compare the new value with DISCONTINUEDATE in order to omit certain records. The SYSDATE field is created as a String value so I can't figure out how to compare the two. Ideally, I would like all records with a DISCONTINUEDATE "<" SYSDATE omitted but I'm not sure how to do this.

 

 

Anyone had success doing this before?

3 replies

Userlevel 4
Badge +13
Hi,

 

Have you tried formatting the date(s) with the DateFormatter or DateConverter?
Badge +3
Yes, or for full control you can use tcl date

 

 

@Evaluate([clock format [clock scan "@Value(DISCONTINUEDATE)"] -format "%Y%m%d"]) - @Evaluate([clock scan "@Value(SYSDATE)"])

 

 

Format as your needs dictate of course..

 

 

 

see

 

 

http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm
Badge +3
That piece was from a workspace...

 

to substract them should be without the formatting..:

 

=@Evaluate([clock scan "@Value(DISCONTINUEDATE)"]) - @Evaluate([clock scan "@Value(SYSDATE)"])

 

You can insert the string in a tester and test for regexp <0 like this

 

 

Reply