How to display filter value as dashboard/report title?
Hi Guys,
I'm trying to achieve something that was not possible in older versions of Yellowfn.
The Case
One of our users asked me a few weeks ago, about a possibility to have some kind of "Title" in a top of a dashboard or some reports who gets the values from the date filters so he can always see the date values applied to some reports.
With code mode, this is reacheable with a few lines of code, but I encountered a problem that I'm not finding the solution in Yellowfin Wiki. Maybe one of you guys can point me to a right direction.
The problem is the following.
this.onRender = function () { let filtroData = this.apis.dashboard.filters.getFilter('Data do Descarte'); console.log(filtroData.valueOne); console.log(filtroData.appliedValueOne); };
The above code does only show the applied value one from his date filter in console. The result from these two lines is the following:
PREDEF_TODAY_BETWEEN
And that's the problem. Yellowfin shows this value on the dashboard or report filter as "Today" or in portuguese "Hoje". This is one of the "Pre Defined Values" from date fields that can be reacheable if we define some date filter to "Values List Selection".
Is there some way to retrieve the formatted data as is shown in the filter?
Thanks in advance,
Renato Marcello
Hi Renato,
Apologies for the delay, it took me a bit to work through this, but I have a working example. I have attached a video of the code in action for reference. So what needs to be done is to start by manually adding an "id" (eg. id="FilterValue") to your text widget so we can grab that in the JS code:
Once you have this, the following JS code will grab the description of the applied filter (which is already translated):
You will notice I have added a class of filterTitle to the div, which is just to keep the styling consistent with the initial "No filter selected" text (as for some reason this default css gets lost once I replace the text). This is just a copy/past of the style applied to the text widget and added to the css code in the dashboard:Hopefully that makes sense, if you have any questions, please let me know.
Cheers,
Neal
Hi Renato,
Apologies for the delay, it took me a bit to work through this, but I have a working example. I have attached a video of the code in action for reference. So what needs to be done is to start by manually adding an "id" (eg. id="FilterValue") to your text widget so we can grab that in the JS code:
Once you have this, the following JS code will grab the description of the applied filter (which is already translated):
You will notice I have added a class of filterTitle to the div, which is just to keep the styling consistent with the initial "No filter selected" text (as for some reason this default css gets lost once I replace the text). This is just a copy/past of the style applied to the text widget and added to the css code in the dashboard:Hopefully that makes sense, if you have any questions, please let me know.
Cheers,
Neal
Hi Renato,
Apologies for the delay, we have been a bit short on staff this week. I will do some testing on this for you and come back to you, but in the meantime, can you confirm that you are looking to just see "Hoje" instead of "PREDEF_HOJE_BETWEEN", is that correct?
Cheers,
Neal
Hi Renato,
Apologies for the delay, we have been a bit short on staff this week. I will do some testing on this for you and come back to you, but in the meantime, can you confirm that you are looking to just see "Hoje" instead of "PREDEF_HOJE_BETWEEN", is that correct?
Cheers,
Neal
Hi Neal,
I'm gonna show you some screenshots so you can see the problem more clearly.
This is the java code, as you can see, I'm just using the date filter to show it's first value in console.
The filter value selected was "Hoje", which are equal to "Today" in english. But in console, the value is "PREDEF_TODAY_BETWEEN".
Can this may be of any help?
Thanks a lot.
Renato Marcello
Hi Neal,
I'm gonna show you some screenshots so you can see the problem more clearly.
This is the java code, as you can see, I'm just using the date filter to show it's first value in console.
The filter value selected was "Hoje", which are equal to "Today" in english. But in console, the value is "PREDEF_TODAY_BETWEEN".
Can this may be of any help?
Thanks a lot.
Renato Marcello
Hi Renato,
Apologies for the delay, it took me a bit to work through this, but I have a working example. I have attached a video of the code in action for reference. So what needs to be done is to start by manually adding an "id" (eg. id="FilterValue") to your text widget so we can grab that in the JS code:
Once you have this, the following JS code will grab the description of the applied filter (which is already translated):
You will notice I have added a class of filterTitle to the div, which is just to keep the styling consistent with the initial "No filter selected" text (as for some reason this default css gets lost once I replace the text). This is just a copy/past of the style applied to the text widget and added to the css code in the dashboard:Hopefully that makes sense, if you have any questions, please let me know.
Cheers,
Neal
Hi Renato,
Apologies for the delay, it took me a bit to work through this, but I have a working example. I have attached a video of the code in action for reference. So what needs to be done is to start by manually adding an "id" (eg. id="FilterValue") to your text widget so we can grab that in the JS code:
Once you have this, the following JS code will grab the description of the applied filter (which is already translated):
You will notice I have added a class of filterTitle to the div, which is just to keep the styling consistent with the initial "No filter selected" text (as for some reason this default css gets lost once I replace the text). This is just a copy/past of the style applied to the text widget and added to the css code in the dashboard:Hopefully that makes sense, if you have any questions, please let me know.
Cheers,
Neal
Replies have been locked on this page!