Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-09-2021 12:21 AM
Hi,
I am new to Neo4j and Cypher. Currently I am using Neo4j Desktop and try to develop my company's internal system.
Now, there are multiple Employee nodes have age property. I want all age property to automatically count up on April 1 every year.
Do you have any idea to solve this issue?
Thanks in advance.
Solved! Go to Solution.
09-09-2021 01:16 AM
You can use the simple solution.
If you don't know their birthday and you want to add their age on April 1, just make all their birthdays on April 1.
09-09-2021 12:50 AM
I think it is possible to use the APOC trigger to update to April.
Better yet, if you have a birthday property then you don't need to handle the count up.
09-09-2021 01:07 AM
Thank you for replying.
Actually I want to add birthday as property, but I can' t do it from perspective of personal information security. So there are no other way but to add age property.
I know I can use apoc trigger, but I don't know how to run Cypher statement to automatically count up age property. So Would you tell me how to do it?
09-09-2021 01:16 AM
You can use the simple solution.
If you don't know their birthday and you want to add their age on April 1, just make all their birthdays on April 1.
09-09-2021 01:24 AM
I see.my issue is solved! Thank you!
09-09-2021 01:51 AM
You can use the date function like this.
MATCH (n:Person)
SET n.birthday = date('1990-04-01')
09-09-2021 12:56 AM
Never ever try to save in a database a state which is changing all the time. Go for the "fixed point in the universe".
You may save someone's birthday, then you will be able to get his/her age at every time.
All the sessions of the conference are now available online