You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edgar Fuste edited this page Nov 2, 2021
·
1 revision
-- For function code use any number of 4 DIGITS starting with '9'. It is reserved for you!!!!
-- FUNCTION CODE: 9280
CREATE OR REPLACE FUNCTION "ud_sample".user_fct_mybasicfunction(p_data json) RETURNS json AS $BODY$
-- Here you can define the example call for your function. Very usefull to debug and to maintenance the code
/*EXAMPLE
SELECT user_fct_mybasicfunction($${
"client":{},
"form":{},
"feature":{},
"data":{ "parameters":{"arcId":"2001"}}}$$)::text
*/
DECLARE
--Definition of all the variables used in the function
v_arc_id text;-- We recomend to use v_* to define all variables to prevent conflicts with columnnames and tablenames
BEGIN
-- Search path - definition of schema in which the function will execute all the processes
SET search_path = "ud_sample", public;
-- Getting input data from the input json
v_arc_id := ((p_data ->>'data')::json->>'parameters')::json->>'arcId';
--Computing process
UPDATE arc SET the_geom = St_Reverse (the_geom) WHERE arc_id = v_arc_id;