I am afraid that Tableau still doesn't support dynamic parameters so we need to figure out another way to achieve what you need. Also the logic you added to dashboard is not possible. Parameters can influence/trigger filters or content, but data from fields can't influence/trigger how parameters work.
What if you just create a new field called "Flag Function" and have it set as this:
[Flag] = 'T'
Then you add this in the Pie worksheet filter and select False. Do the same in the Bar worksheet and set True. This way, when the DB sends T to Tableau, then the Bars will show up. If the DB has something else then you will have the Pie.
I hope this helps