Skip to main content
Solved

Create A HREF based on dataset filters

  • Jul 31, 2025 8:03 AM UTC
  • 1 reply
  • 51 views
  • Translate All

danny.oneill
Forum|alt.badge.img+2

I have a little code block on a custom view/code page which links to the dataset. See below:

<div class="advanced-kpi--bottom">
<div class="advanced-kpi--bottom-second-stage">
<a class="source"
href="/explore/dataset/{{ ctx.dataset.datasetid }}/table/" target="_blank" rel="noopener norefer">
View Source <i class="fa fa-long-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>

I would like the href to be dynamic to either use the refine in the dataset context parameters or based on some on page filters. See this page for the filters in question: https://cityobservatory.birmingham.gov.uk/explore/dataset/percentage-households-in-fuel-poverty-wmca-wards/insight/

Is this possible? The URL sync is on if that helps. Or do I need to hard code the refine.arealabel into the URL path?

Best answer by Thomas R.

Hello Danny,

 

In order to do that you’ll need to use a specific function to get parameters out of the filtered context.

 

<div class="advanced-kpi--bottom">
<div class="advanced-kpi--bottom-second-stage">
<a class="source"
href="/explore/dataset/{{ ctx.dataset.datasetid }}/table/?{{ctxfiltered.getQueryStringURL()}}" target="_blank" rel="noopener norefer">
View Source <i class="fa fa-long-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>

 

This is described in the documentation in the Properties of odsDatasetContext used as variable section if you want to dig more on the topic.

 

Best regards,

Thomas 

View original

1 reply

Thomas R.
Huwise Team
  • Huwise Team
  • Answer
  • Jul 31, 2025 2:26 PM UTC

Hello Danny,

 

In order to do that you’ll need to use a specific function to get parameters out of the filtered context.

 

<div class="advanced-kpi--bottom">
<div class="advanced-kpi--bottom-second-stage">
<a class="source"
href="/explore/dataset/{{ ctx.dataset.datasetid }}/table/?{{ctxfiltered.getQueryStringURL()}}" target="_blank" rel="noopener norefer">
View Source <i class="fa fa-long-arrow-right" aria-hidden="true"></i>
</a>
</div>
</div>

 

This is described in the documentation in the Properties of odsDatasetContext used as variable section if you want to dig more on the topic.

 

Best regards,

Thomas 

Translate