Download data to CSV file from SAP Lumira visualization and storyboards
Dear SCN Community,
I have been working in SAP Lumira since 5 months and my experience with this tool is amazing. But one thing I noticed is, at present I don’t see an option wherein we can download data back to either “.csv” or “.excel” format from Lumira desktop.
I believe this is feature is quite useful and most of us love the data enriching and saving the data in our local files for future purpose.
I thought of creating this feature as a custom extension in SAP Lumira.
Here it is:-
Step 1
The below screen has button style custom extension which I have created. I have selected few dimension and measures.
Step 2
I clicked on the button “Export to CSV”. It popup a window asking file saved in which location.
Here i gave filename as “dataexport” and location at desktop.
Step 3:
Here I am opening the saved “dataexport.csv” to see the contents
Step 4:
I have used the same extension in story board as well to see filtering data is exported correctly.
Step 5:
I have used input control to filter the state to “Andhra Pradesh” and exported the data by clicking export data button.
File Name Given: dataexport-andhrapradesh.csv
Location: Desktop
Step 6:
Verified the contents of the file “dataexport-andrapradesh.csv”. Yes only “Andhra Pradesh” state data is exported.
This is very small feature and I believe this very much useful. Hope you guys like this.
With regards,
Hari Srinivasa Reddy, Manager SAP Analytics
NTT DATA
Would it be possible to see the source code that you wrote for your plugin? Or is this just an idea that you have for a feature? If it is an idea - I would recommend creating an ideaplace posting and linking to this blog. If it is an actual plugin that you have created - I would be very interested in seeing the source code for it.
Hope you have seen the source which shared here.
This option "export to csv " is not coming . How did you get???
Hi,
this is a custom extension that he is showcasing, therefore a small piece of code that he has enhanced a chart type with.
for what it's worth, this functionality is possible today in the current tool (albeit using slightly longer workflow):
regards,
H
Sorry. Some how I missed to follow this post.
Yes as Henry rightly said is this is custom extension built.
Here the sample code of render function.
var render = function(data, container, width, height, colorPalette, properties, dispatch) {
//prepare canvas with width and height of container
container.selectAll('svg').remove();
var vis = container.append('svg').attr('width', width).attr('height', height)
.append('g').attr('class', 'vis').attr('width', width).attr('height', height);
container.selectAll('svg').remove();
var vis = container.append('svg').attr('width', width).attr('height', height)
.append('g').attr('class', 'div').attr('width', width).attr('height', height);
var margin = {top: 30, right: 30, bottom: 0, left: 30},
width = 200 - margin.left - margin.right,
height = 200 - margin.top - margin.bottom;
var b = {w: 75, h: 30, s: 3, t: 10};
var dsets = data.meta.dimensions(0);
var msets = data.meta.measures(0);
var dimenion01 = dsets[0];
var dimenion02 = dsets[1];
var measure01 = msets[0];
var measure02 = msets[1];
var fdata = $.map(data, function (d, i){
return [[d[dimenion01] , d[dimenion02] , d[measure01], d[measure02]]];
});
vis.append("rect").attr("x",width/2)
.attr("y",height/2)
.attr("fill","green")
.attr("width",150)
.attr("height",50)
.attr("rx","10")
.attr("ry","15")
.style("stroke", "black")
.style("stroke-width","5")
.style("cursor","hand")
.on("click",function(d, i){
var csvContent = "data:text/csv;charset=utf-8,"
var csvContentArray = [];
for (i=0;i<fdata.length-1;i++){
csvContentArray.push(fdata[i])
}
csvContent = csvContent + csvContentArray.join("\n");
var encodedUri = encodeURI(csvContent);
window.open(encodedUri);
window.close
});
vis.append("text")
.text("Export to CSV")
.attr("font-size","15px")
.attr("font-weight","bold")
.attr("fill","white")
.attr("x",(width/2) + 150/2)
.attr("y",height/2+ 60/2)
.attr("text-anchor","middle");
// END: sample render code
};
Hope this helps.
Cheers,
Hari