I am trying to display two tabs in microstrategy web, based on a predefined string inside a text container.
For example, I want to display one tab for a user that fits into the "Trader" category only. If the text in a container that I made in the tab page has the text "Trader" as a string, then the tab display will change to block to show that page to Traders, else it will change it to none and will change the display style to block on the page for the other type of clients instead.
Right now I am stuck at trying to make it work when the user changes tabs, since at first load, one of the tabs is hidden and one is shown depending on the text container,as intended, but when I switch to other tabs/pages on the dashboard then both are being shown.
What do you suggest to make it work even when I switch between pages/tabs?
This is what I have so far.
Thank you guys!
<script type="text/javascript">
(function verify_branch(){
if(document.getElementsByClassName('vi-doc-tf-value-text')[0].innerHTML == "Trader")
{
document.getElementById("mstr2056").style.display = "block";
document.getElementById("mstr2058").style.display = "none";
console.log("Trader");
}else{
document.getElementById("mstr2056").style.display = "none";
document.getElementById("mstr2058").style.display = "block";
console.log("Other");
}
})();
</script>
you can use a global variable like displayDefault and check that as well