Set Parameter Value from table via Click to pass that parameter to another Dashboard

Hi, I have created a script, which should set a parameter (date) to a specific value. The Parameter is passed to another Dashboard to set a date filter. Therefore I have used a click action with the script and a navigation action with a parameter passing.

It seems that I have a mistake in the script. It seems that the parameter is not changed at all.

// Get the parent view.
var parentView = this.parentView;
// Get the view parameters.
var viewParameter = this.parentView.control.getViewParameterByName(“Date”);
// Click Event
if (e.relatedData) {
// Get the cellset
var cellset = e.relatedData.metricSetBinding.dataResult.cellset;
var columnOrdinal = e.relatedData.columns[1];
var rowOrdinal = e.relatedData.rows[0];
var Datum = cellset.cells[columnOrdinal][rowOrdinal];
//Set Parameter
viewParameter.parameterValue = Datum;
}
viewParameter.refreshAllAdapters();

Thanks.

Hi Alexander,

I may have misunderstood, but if you’re aiming to get the value that has been clicked, I think the “error” is that you’re not pointing to the correct cellSet, you should do this:

var cellSet = TheTableOnWhichTheClickHasBeenDone.metricSetBindings[0].dataResult.cellset;

// for getting the ordinals please refer to this
// https://www.dundas.com/support/developer/script-library/Controls/Table/Get-Selected-Table-Data

//then for getting the value
// if it’s a date
var Datum = cellSet.rows[rowOrdinal].members[columnOrdinal].memberTime;

// if it’s a string
var TheString= cellSet.rows[rowOrdinal].members[columnOrdinal].caption;

//if it’s a CollectionMember
var TheCollectionMemberUniqueName = cellSet.rows[rowOrdinal].members[columnOrdinal].uniqueName;

//for a number value I haven’t tried yet

I hope this helps.
Olivier

1 Like

and for getting the exact ordinals of the cell that has been clicked, as far as my understanding of the API is correct, you could use:

var rowOrdinal = null;
var columnOrdinal = null;
if (e.relatedData)
{
rowOrdinal = e.relatedData.rows[0];
columnOrdinal = e.relatedData.hitTestResult.colIndex;
}

2 Likes

Hi Olivier,

thanks for your advice and tipps.
I will edit and test the script and give feedback.

Alex

Hi Olivier,

thanks for your tipps.
I have edited my skript so that I can see the value, which is written in the variable.


When the “Datum” cell is clicked, the cell value is shown as 1,00.

Attached you find the script:

// Get the parent view.
var parentView = this.parentView;
var viewParameters = parentView.control.viewParameters;
var viewParameter = this.parentView.control.getViewParameterByName(“Date”);
var interactiveDataString = ‘’;
// Click Event
var rowOrdinal = null;
var columnOrdinal = null;
// Get the cellset
var cellSet = table8.metricSetBindings[0].dataResult.cellset;
if (e.relatedData)
{
rowOrdinal = e.relatedData.hitTestResult.rowIndex;
columnOrdinal = e.relatedData.columns[0];
var Datum = cellSet.cells[columnOrdinal][rowOrdinal];
interactiveDataString += '

Cell Value: ’ + Datum.formattedValue + ‘
’;
//viewParameter.refreshAllAdapters();
}
else
{
interactiveDataString += “No data selected.”
}

Thanks!

1 Like