Reputation: 634
START customerName=node(483), b = node(485, 498, 500)
MATCH customerName-[s:Sell]->b
WITH s.transactionDate AS date, customerName, b, sum(s.transactionAmount) AS total
CREATE customerName-[:sales_summary { date:date, tamt:total }]->b
Here I want to replace sales_summary relation into runtime date using MMM YY format.
like customerName - Sep 08 (tamt = total) -> b here edge name = Sep 08 -- runtime value from date
Upvotes: 1
Views: 279
Reputation: 903
I faced a similar challenge. For an SQL equivalent of TO_DATE(node.Date_value) > TO_DATE('01-JAN-09','DD-MON-YY') or something similar.
I guess currently we may have to go through the following steps:
a) Create nodes for Year Month, date using the code snippet provided here by Mark Needham. b) Remember to make changes from MM-DD-YY (numerical) to DD-MON-YY inside the case conditions as per your data.
As Alan Robertson points out in the post comments, it is also an excellent way to understand neo4j functioning better for newbies like us even though it may require creating a few thousand nodes in the database which does not occupy much space.
This may not be an optimal answer, but may help to bail out from the immediate problem.
The best alternative is provided by Michael Hunger in here. One of the ways to do it is to create an extra property which is unix epoch of the date and then divide the values by 86400 to get resolution of day. Thereafter, date manipulations can be done.
Upvotes: 0
Reputation: 6331
Cypher does not have date manipulation methods in itself. You probably want to set the date on the relationship as a long, and then format MMM YY in your presentation code, which is much more performant in the database anyway.
Upvotes: 1