This isn't a Function issue, it's a Trigger issue.
Manual:
[quote:1k46yh8e]Since triggers run upon an event happening, they aren't checked in top-to-bottom order like other events. This means the ordering of triggers relative to other events is not important (except relative to other triggers of the same type, since triggers still fire top-to-bottom).
A trigger doesn't have any context outside of itself. Just because you place it in a certain location doesn't mean it has context in that location.
Move your 'Text set' to 'On start of layout' - also ignored, since it's a trigger.