A truth table function can reside anywhere in a chart, state, or subchart. The location of a function determines its scope, that is, the set of states and transitions that can call the function. Follow these guidelines:
If you want to call the function only within one state or subchart and its substates, put your truth table function in that state or subchart. That function overrides any other functions of the same name in the parents and ancestors of that state or subchart.
If you want to call the function anywhere in that chart, put your truth table function at the chart level.