cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

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

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