Hello.
It seems to me that the frontend is working with variables a little incorrectly.
I created a backend function:
`$BODY$
DECLARE
--n1 TEXT := 'HP';
--n2 TEXT := 'HP';
N integer;
BEGIN
IF EXISTS (SELECT 1 FROM {app_izdeliya}.[tip_izdeliy] WHERE (app_izdeliya.tip_izdeliy.tip_izdeliya)=text_for_check LIMIT 1) THEN
N := 1;
ELSE
N := 0;
END IF;
RETURN N;
END;
$BODY$`
It works correctly and returns 0 or 1.
I also created a frontend function:
app.call_backend({app_izdeliya.check_tip_in_base}, app.get_field_value({F0: 0 tip_izdeliy.tip_izdeliya})).then(
res => {app.set_field_error({F0: 0 tip_izdeliy.tip_izdeliya}, res) }, // if success: return value in 'res'
err => { } // if error: error message in 'err'
)
If I enter something that is not in the database, then 0 is displayed.
If I enter something that is not in the database, then either nothing is displayed (if it was not entered previously), or 0 continues to be displayed (if there was a check previously that it was not in the database).
But if you do something similar for relation, the display occurs correctly. (0 if there is none and 1 if there is).
Platform version 3.9.2.5465