Here’s another one:
I have a calculated attribute, code is this:
exposed function get foodprefs()->result : string
var prefs : string
if (this.cancook)
prefs="Kochen,"
else
prefs="Direkt,"
end
prefs = prefs + ((this.nopork==true) ? "NoPorc," : "")
prefs = prefs + ((this.nosugars==true) ? "NoSugar," : "")
prefs = prefs + ((this.microwaveonly==true) ? "MW," : "")
result = prefs
return result
This function seemingly does not work, and I can only assume that comparisons with attributes that are declared as Bool but were never initialized and are thus null lead to an error.
Even just one entity’s failed calculated attribute stops everything else, no data at all is displayed, no button works, everything is just not working.
Btw I first tried “prefs+ =” - that should work, I dont know if it does.
Somehow I keep returning to one of the major gripes: It is extremely hard to get to the bottom of erroneous code. And since there is seemingly little tolerance when it comes to attributes having unexpected values, it makes matters worse.
How much sense does it make to define an attribute with a type if an entity’s attributes are not properly initialized upon creation?
What makes this even more troublesome is that extending an entity with new attributes means that preexisting entities have attributes that are not properly initialized even if I initialize every new entity directly after creation.