Thanks! OK, it’s is very complex. the first thing I would do is go through and review all your action code to use correct syntax. So:
if($StartDate.format(w)=Fri & $Turno=Noite){$Plantonista=Jose};
_May work, but this is he correct version:
if($StartDate.format("w")=="Fri" & $Turno=="Noite"){$Plantonista="Jose"};
Note that literal strings, including date format strings, are put in quotes: "Noite"
, .format("w")
, etc. Also dates are not:
$EndDate=$StartDate + 12 hours;
but
$EndDate=$StartDate + "12 hours";
In queries, e.g. in if()
, do not use ‘=’. So not X=Y
but X==Y
.
For this code (where I have broken the code onto multiple lines just for clarity, but you don’t need this for actual use):
if($DueDate.format(d/m/y)!=$Tags){
$Color="Red"
} else {
$Color=
};
In the else
branch to set $Color to the default/inherited values use =;
not =
. Thus:
if($DueDate.format("d/m/y")!=$Tags){
$Color="Red"
} else {
$Color=;
};
$Tags is a Set, i.e. multi-value attribute. So, by using !=
you are testing a string representation of all the set’s values.
For your agent queries, again, quote strings. So:
$Plantonista==Jose & descendedFrom(/2020/Outubro)
Becomes:
$Plantonista=="Jose" & descendedFrom(/2020/Outubro)
In the case of descendedFrom()
, you are correct as the convention is to use either an unquotes $Path (as here) or a quoted $Name.
As well as cleaning up the code, so you don’t have accidental side effect, I would delete all the false starts in the document. When testing at this stage, use the smallest possible amount of notes/data/values so you can see what’s going on.
As it is there are too many abandoned tests to fully understand your TBX, although I understand the general concept.
So I suggest:
- Delete anything notes that are not part of the logic we are testing
- For the remaining notes/agents, fix all the queries/rules/edicts etc so they use correct actions code
…and then re-upload. If you get stuck with correcting the code, just ask. however, I hope the examples above give you enough examples.