Quantcast
Channel: SCN : Blog List - SAP BusinessObjects Lumira
Viewing all articles
Browse latest Browse all 855

Creating My First Data Access Extension For Lumira

$
0
0

Hello Everyone,

 

After my initial posts on Predictive Custom R Scripts, i was advocating the idea that we need more extensibility on our new solutions, like a data connector sdk, enabling customers and partners to create new connectors.

Somebody must have heard me, Lumira Data Access Extensions were ready when we came to version 1.17 and anounced with a MongoDB connector here

From that moment, asking for this functionality i feel obliged to come up with an extension I asked for it, now i need to use it right

 

1) The Idea,

I believe the hard to reach data sources would be "Cloud" ones, because they will all have a specific api that you need to talk to. To demonstrate this i decided to go with a Google Spreadsheets extension, so i can utilize my cloud spreadsheet data, and that data can be updated by other apps too.

 

2) The problem, and the solution

Ok, now the problem is how do i create an extension? Data Access Extensions Developer Guide explains it all! But what if you dont have any idea how to code, and how to create an executable? There Python language comes handy! You can very easily learn it, create your programs and pack them into executables. I can understand why it is so popular!

 

3) Lets create a Google Spreadsheet

1) Go to https://drive.google.com/ and create your Spreadsheet as illustrated :

 

ScreenHunter_628 Aug. 31 02.21.jpg

 

2) Paste some data into your spreadsheet (first row needs to be column titles). I'm using the famous Titanic Dataset here.

 

ScreenHunter_629 Aug. 31 02.28.jpg

 

3) At the next step we need to make our spreadsheet accesible without a login (so we don't have to deal with authentication in the extension). I've chosen "Anyone with the link" can access it.

 

               ScreenHunter_640 Aug. 31 03.59.jpgScreenHunter_638 Aug. 31 03.58.jpg

 

4) In addition to that, we need to "Publish" our spreadsheet to web, (from File -> Publish to the web) as illustrated in the following screenshots,

 

           ScreenHunter_631 Aug. 31 02.28.jpg

 

5) Now that our spreadsheet is ready, we can move on, but one final thing, our spreadsheet has a "key" that will help us reach it later. You can find it in the middle of spreadsheet url. Copy it down to somewhere handy :

 

ScreenHunter_633 Aug. 31 02.29.jpg

 

 

4) Getting our Lumira ready for the extensions :

 

There are a few things you need to do to active Data Source Extensions in Lumira :

1) In C:\Program Files\SAP Lumira\Desktop, open SAPLumira.ini file.

2) Add the following entries to the SAPLumira.ini file, and save the file.
       -Dhilo.externalds.folder=C:\Program Files\SAP Lumira\Desktop\daextensions
       -Dactivate.externaldatasource.ds=true
3) Create the folder "C:\Program Files\SAP Lumira\Desktop\daextensions"

We are ready to go!

 

5) The code :

Disclaimer : This is my first time trying Python and i'm in no means a programmer. So sorry for the disturbance and the sloppy coding Also this extension is not supported by SAP! Do not use for anything serious!


I think the developer guide and the implementation method is pretty straightforward and i advise anyone intrested to have a look at the guide.

Lumira expects you to implement "Preview", "Edit" and "Refresh" workflows, and send parameters and data in a specific format. The good thing is it stores your parameters safely so you dont have to ask for the url, key etc. again when user wants to refresh. You will be "reminded" by Lumira.

Let's find out our parameters and in which workflow we are currently in :

 

ScreenHunter_703 Sep. 12 00.20.jpg

 

Then all we need to do is to implement required dialogs and data access :

 

ScreenHunter_642 Aug. 31 12.10.jpg

 

I can share the full Python code if someone's intrested.

 

6) Let's try our extension

 

After copying our result ".exe" file into the "C:\Program Files\SAP Lumira\Desktop\daextensions" directory, Lumira will have a new option in the Source pane. Select it and click "Next", you will see our first extension waiting to be used :

ScreenHunter_658 Sep. 10 14.23.jpg      ScreenHunter_635 Aug. 31 02.32.jpg

 

When selected, you will see a popup window asking you for your spreadsheet key, paste your key and click ok.

 

ScreenHunter_636 Aug. 31 02.37.jpg

 

Voila!!! We have our data preview! Click Create to acquire your data from Google Docs :

 

 

ScreenHunter_643 Aug. 31 12.22.jpg        ScreenHunter_644 Aug. 31 12.24.jpg

 

You can click "Ctrl - R" keyboard shortcut or use "Data --> Refresh" menu anytime to refresh your data from the source Google Spreadsheet.

 

 

7) Results, Executable And Next Steps :

 

I think i have reached a re-usable extension in the simplest manner.

To use it with your own Lumira, just copy it to the extensions directory, default is :

 

ScreenHunter_645 Aug. 31 12.37.jpg

 

Again, this is just a personal project and is not supported by SAP

 

Youcanfindpythonsourcefileandexecutableingithubhere


Disclaimer : This blog post and included extension is a personal project and is not supported by SAP. And not supported by me either! If you want to know what the code is doing, you can check the source codes that are also found in the github repository.


If i find some time, i'd enhance this extension to utilize authentication so you won't have to make your spreadsheet public. And in dialogs i could provide your existing worksheets so you can chose one without the need for a key.

 

Another enhancement point would be to support proxies, meaning you can't use it behind a proxy right now.

 

Coming up next... A Twitter extractor for Lumira !!!


Viewing all articles
Browse latest Browse all 855

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>