Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-27-2020 12:23 AM
Hello Team ,
I need a help in knowing logic for getting multiple values for 1 property name ( ENB_NAME ) calculated on the some formula in return statement.
PROPERTY Names used are:
For example
formula for calculating
ENB_NAME = 'cNum'+LTEANT_CELL_NUMBER
ENB_NAME = 'cNum'+ SEC_LTEANT_CELL_NUMBER
OUTPUT:
ENB_NAME = > cNum20
ENB_NAME = > cNum9
Regards
Akshat
03-27-2020 02:11 AM
If you are testing based on the null value of then try below LTEANT_CELL_NUMBER /SEC_LTEANT_CELL_NUMBER then you can try below. Else you can can apply any logic based on the requirement
RETURN ENB_NAME= CASE WHEN (LTEANT_CELL_NUMBER is null) THEN 'cNum'+'LTEANT_CELL_NUMBER' WHEN ( SEC_LTEANT_CELL_NUMBER is null ) THEN 'cNum'+'SEC_LTEANT_CELL_NUMBER' END
03-27-2020 07:35 PM
It may be even easier to leverage the coalesce() function, which chooses the first non-null value:
RETURN 'cNum' + coalesce(LTEANT_CELL_NUMBER, SEC_LTEANT_CELL_NUMBER) as result
If this isn't what you're asking for, then you may need to provide more details as to what you're doing, an example of your data and attempted queries so far may help.
03-27-2020 10:49 PM
Hi Andrew ,
Thanks for your efforts.
But My case is " 1 Property name ( ENB_NAME ) needs to have 2 different values on the basis of 2 other peroperties ( LTEANT_CELL_NUMBER & SEC_LTEANT_CELL_NUMBER ) in return statement".
For example if LTEANT_CELL_NUMBER = 5 & SEC_LTEANT_CELL_NUMBER = 10 then value of should be
ENB_NAME = cNum5
ENB_NAME = cNum10
Regards
Akshat
03-28-2020 04:24 AM
I think you need to explain more. A variable cannot have multiple values simultaneously, unless you want to represent it as a list of values. Is that what your'e after?
If you want to return one value in one situation, and another value in another situation, then you can use CASE expressions for this.
A more complete example of desired input and desired output (using Cypher, if possible!) would help.
All the sessions of the conference are now available online