The function works otherwise fine, expect doesn't return anything on a dedicated server.
_state = toUpper (taskState _taskReal); if (_state == "") then { _state = GET_DATA(_taskVar,STATE); }; _state
The if statement should be replaced with
isNil "_state"
as taskState doesn't return an empty string, it returns nothing.