cancel
Showing results for 
Search instead for 
Did you mean: 

APOC call custom function in another function

dlyberis
Node Link

Is it possible to call a custom function in another custom function? This is an example of what i whould like to implement but i am getting errors .

 

 

CALL apoc.custom.declareFunction(
  'AQI(pollutant::STRING, value::NUMBER) :: STRING',
  '
    RETURN CASE
    WHEN $pollutant = "pm2.5" THEN return custom.aqi_2_5($value)
    WHEN $pollutant = "pm10" THEN return custom.aqi_10($value)
    WHEN $pollutant = "so2" THEN return custom.aqi_so2($value)
    WHEN $pollutant = "no2" THEN return custom.aqi_no2($value)
    WHEN $pollutant = "o3" THEN return custom.aqi_o3($value)
  END          
  '
);

 

dlyberis_0-1660860698416.png

 

Thank you in advance.

1 REPLY 1

glilienfield
Ninja
Ninja

Try removing the ‘return’ clause on lines 5-9.  That is not needed in the case statement 

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

On November 16 and 17 for 24 hours across all timezones, you’ll learn about best practices for beginners and experts alike.