Hello guys,
i´m very new to arcade language so i trying to build a timer with a dinamic starting and ending time:
So i got this so far:
var dataini = Now();
var stat = "Closed";
if (stat == "Closed") {return dataini};
var datafim = 1;
So what i need is that my timer stops counting once my "stat" varaible is equal to "Closed".
I also need to grab that exact time an make it my "datafim" variable.
Hope you guys can help me... Thanks a lot in advance.
Greetings from Portugal
Arcade is a relatively simple language. Things like POST requests, asynchronous processes and sleep() are not possible. What you describe doesn't seem possible in Arcade.
What is your end goal here? Maybe it can be achieved in another way (or not at all, but then you know...).
Hello Johannes,
First of all thanks for your quick reply. According to my research this will be possible. The first thing that im having problems is that i have only one date/hour field and i have to use only that field to retrieve 2 variables. My starting date/time and my end date/time. In Python that would look similar this:
#dataocrr is my data/time field name
# stat is my field that i will use to a conditional formatting so to speek
#datafim is my end data/time field name
dataini = dataocrr - #simple right?
When stat == "Closed":
return dataini as datafim
How can i do this in arcade!? Is it possible?
Have a nice day, and thanks again.
Ah, I misunderstood your original question.
So you want to calculate a field "datafim" based on the fields "dataoccr" and "stat"? You can do that by using this expression in the CalculateField tool or in an Attribute Rule:
// Calulation Attribute Rule
// or Calculate Field
// on field "datafim"
var dataini = $feature.dataoccr // read the dataoccr field of the current feature
if($feature.stat == "Closed") { // if the value of field "stat" is "Closed"
return dataini
}
return null // $feature.stat != "Closed"
Hi again Johannes,
Thanks for the reply, i got that far myself, my problem was on to turn that returned value my other varaible ("datafim"). Can i do: " return dataini as var datafim"?
Thanks again, have a nice day.