How to add hard code text in cypher query

Hello Team,

May I know how to add hard code text in cypher query so that my query output should give sufficient information like below?

Current Query : MATCH (n:AMASSET) detach delete n;

Expected Query / or expectation in output is : match (n:PERSON) detach delete n "Deleting the label"


Hi @akshat.mittal
Do you want remove / replace label?

If that is the case:

RETURN, labels(n)

Hello Paul,

Actually I know how to remove a label but i need some text in output which states that specific label is removed.



So you would get output something like
1 row, Labels removed: 1, removed labels: ('AMASSET')

Hello Paul ,

I got the output like this:

But i need some manual text should be displayed when deletion is completed like " TESTAMEMPLDEPT Label deleted "

I hope u got my ask.


I think i am still a bit lost here. Can you please describe a use-case in more detail, why you need to do this?

Hello Paul,

No Worries mate.

Let me clear my requirement.

I need the hard code text like below which i used while running apoc.periodic.iterate statement:

"Total batch count for LOCATION", batches, "Total Records Loaded:", total, "Total Time consumed in seconds:", timeTaken

"Total batch count for LOCATION", 397, "Total Records Loaded:", 396045, "Total Time consumed in seconds:", 61

Similarly i need some hard code text when i run the detach delete command for removing the label.

For example : "Deleting XYZ label" < Label Name in Actual >

Best Regards

You can always manually add that as a RETURN:

MATCH (n:Node)
WITH count(n) as deleteCount
RETURN 'Deleted ' + deleteCount + ' nodes of label: Node' as result

Something like that.

Also keep in mind there are some statistics that do come back and available for use in code, but may not be apparent when working via the browser. Check the Code results tab when the query returns. The summary section will give you some meta-data of the number of elements deleted or added as a result of the query, though it doesn't track the origins of them.

Remember that nodes can be multi-labeled, so that info won't be readily apparent when executing your query, and you won't know which relationship types were deleted as a consequence of the detach portion either.


Hello Andrew,

This is what i was asking.
Thanks a lot for providing it.

Regarding code tab in browser , Is it possible to use those parameters in cypher query statements? If yes , please share some example so that i can use it in my query.


The response metrics are generated by the execution of the Cypher, it cannot be used as parameters to the query. You could programmatically extract that info in your driver code though and use those as parameters to a subsequent query.

Hello Andrew,

I understood the point.
Any example or small program where someone has use those parameters in query!

Best Regards

You'll want to review the Neo4j driver documentation, specifically the part about working with Cypher values, notably the statement results and result summary.

The idea is that you will use the driver to execute the query. Then, when all results have been consumed, you can use a method on the Result object to get the ResultSummary. You'll use the API of whatever version/language of the driver you're using, but for example, if you were using Java, here's the Result interface, and you would use the consume() method to get the ResultSummary object, and from that you could use the counters() method to get the SummaryCounters object which you can use to get the counts of what changed because of the query execution.

From there it's just a matter of extracting what's important to you, and passing those as parameters to your next query.