Skip to main content

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?

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 


Reply