Dashboard: Get/Set Labels on Dashboard
- 3 years ago
args.ComponentInfo.Component represents the component that triggered the rule, which in your case (you're talking about "on load") is probably the Dashboard itself.
You have to switch the mindset around a bit: instead of pulling strings from centralized code, you set Parameters on the components' properties (e.g. in the Text property of a Label), and let widgets pick up actual values when they get drawn. You can call BRApi.Dashboards.Parameters.SetLiteralParameterValue from any code to change those values, for example when the dashboard loads (since it will do that before widgets, so Parameters will be populated before the Components are drawn); if you change a Parameter after the whole page was displayed, you will have to refresh the Dashboard containing affected widgets to see new values in action.
So for example, I have a parameter on my label here:
And then in a rule that runs on load, I set the parameter:
brapi.Dashboards.Parameters.SetLiteralParameterValue(si, False, "ST_Balance", newBalance)