Hello!
I'm writing a Arcade expression to input data in a serial chart in Dashboards.
The goal is to replace the string values to numbers so I can order the bars and keep the string as the label.
This function retrieves the feature set using FeatureSetByPortalItem, gets the first feature using First, and assigns the value of the 'ultima_consulta_medica' field to the variable ultima_consulta_medica.
The Replace function is then called on ultima_consulta_medica, replacing the string 'Menos de 1 mês' with the number 1.
var featureSet = FeatureSetByPortalItem(Portal('myPortal'), 'xyz' , 1, ['ultima_consulta_medica'], false);
var feature = First(featureSet);
var ultima_consulta_medica = feature['ultima_consulta_medica'];
ultima_consulta_medica = Replace(ultima_consulta_medica, 'Menos de 1 mês', '1');
return ultima_consulta_medica;
I was stuck trying to make the expression loop through all the values of the ultima_consulta_medica. I need the end result to replace the string with '1'.
I also don't know if my approach was the best way to resolve my problem.
Any suggestions?