I have worked up a solution using a Data Cube with Data Input functionality where the users can enter in simple data and this works great. The users view the data through a table on a dashboard. I would like to add a column with a delete button or image to call a script to delete the record but can’t see how I could do this. If you use data input, how do you let your users delete records? I know I can delete them in the data cube myself and I have the actual script syntax to delete a record but how do I trigger the script from a table on a dashboard (not scorecard). Thanks for any ideas.
Deleting Data Input Records
Hi @kelly.lowary,
Here is how I have approached deleting input records in the past.
First, make sure you include the RecordId in the metric set displaying the table you want to delete from. You don’t have to show it in the table but it has to be in the Metric Set. RecordID is something that is included in your Data Input cube when you create it and it’s needed to identify which row you want to delete.
Then do something like this where you first find the row (and maybe column that was clicked):
var args = dundas.Utility.getAdapterHitTestArguments(e.originalEvent, table1);
var hitTestResult = table1.control.hitTest(args.offsetX, args.offsetY, args.target);
var rowIndex = hitTestResult.rowIndex;
var colIndex = hitTestResult.colIndex;
check what was clicked and react:
if (colIndex == 3)
{
var recordId = table1.metricSetBindings[0].dataResult.cellset.rows[rowIndex].members[5].caption;
var inputService = dundas.context.getService("DataInputService");
var def = inputService.deleteDataStorageRecord("28c4db73-6b38-46f2-8ada-283063d5a50e", "abac74f0-8b37-4a87-aefd-693409d1709b", recordId);
// Reload the table once deleted
def.done(function (message) {
table1.loadData();
});
}
In the script above you can see two large GUIDS ‘28c4db…’ and ‘abac74…’. Take a look at the documentation for deleteDataStorageRecord and you’ll see that these are your Data Cube ID and Transformation ID from the Data Cube.
You might even do something interesting like having a column that only shows an image of a trash can which signifies delete to the user.
Here also is a video that I did on the subject which might have some helpful ideas.
@jeff, thank you so much! That is exactly what I was looking for and it works perfectly. The video is what helped me get the entire Data Input working in the first place so thank you so much for that as well. I really appreciate that you monitor this forum and provide such helpful feedback.