Hello evrybody,
i have somme problème on Arcade statement, i want to insert into a field an expression
i have à table that containe a field "code_pat" as texte where i put à unique calculated id.
The field is composed of two section : text and number like this (PAT0001 -> PAT (text) and 0001 (number)
on insert in want to automaticly add the value with arcade as attrubute rules. so i have to use 3 functions:
1- right, to get the four digit
2- number, to convert each one into number
3- max, to calculate the maximum and add 1
after that i concatenate "PAT" + the max+1 and put il in the field.
My arcade :
var features = FeatureSetByName($datastore,"patrimoine",['*']);
var txt = [];
for(var z=0; z<count(features); z++) {
txt[z]= features.[code_pat].[z]
}
var nb = [];
nb = number (txt);
var num = max (nb);
return "PAT" + text(num + 1,'0000');

i got error in this line :
txt[z]= features.[code_pat].[z]
how can i fixe this?
thanks you for your helps