Design Studio SDK (1.4) – Datasource SDK Test
EDIT (11/26/2014): Github Source for this moved to a different 1.4 Git Repo — Installable .ZIP can be found there, too.
entmike/DesignStudio1.4SDK · GitHub
Original Post:
So, 1.4 is available.
I went straight to Help -> Help Contents -> Developer Guide -> SDK Extensions as Data Sources (Data Source SDK)
After reading about the two types of Data Sources (DataSource and its extended version DataBuffer), I decided to try my luck with a Data Source Test SDK Component using DataBuffer. Details of the two types are in the help guide.
I then made sure to download the 1.4 SDK Samples here: http://help.sap.com/businessobject/product_guides/AAD14/en/DS_14_SDK_SAMPLES.zip
Eclipse SDKer note: Don’t forget to update your sdk.xsd reference with the new one provided!
Test 1:
I first took a look at the example ‘Constant Data Source’ SDK example. It basically is just a hard-coded Data Source JSON structure to demonstrate structure expected to be returned:
So below we just see evidence that it indeed does work with a simple Chart Component.
Test 2:
I moved on to see what the ‘CSV Data Source’ SDK example had to offer. It appears to be simple as well (as examples should be) to show how you can point a Data Source to a URL hosting a CSV file and return it JSON format.
It indeed does just that (CSV URL: http://mikehowles.com/data2.csv )
Test 3 – My Turn!:
How about letting the designer just paste in some CSV text at design time instead of hosting it somewhere? Also maybe allow for some crosstab rows/columns flipping (very primitive) and specifying how many dimensions are in columns? No idea how much of this is a good idea but it sure seems to work!
Example when setting ‘Measures in Rows’ to true:
Also, I have a proof-of-concept parameter called ‘Mutators’ and this is just to allow for what-if analysis via design time or BIAL methods:
Setting the ‘Mutators’ array to [0.25,1,2] basically just multiplies the first measure by .25, the second by 1, and the third by 2:
I also added one BIAL Method called setMutator that allows us to modify measures at runtime.
Sure enough, at runtime when running the code, the first measure changes to 40% of it’s original value.
(Caveman simple) what-if analysis successful! 😀
Observations:
Come components don’t seem to acknowledge SDK Datasources existence. Maybe I’m doing something wrong however even the SAP Samples did not work with the Crosstab or Filter Panel components. The message in those components would say “Data source not loaded”.
The Chart component and my other databound SDK components DID work with them though (all the screenshots I took).
Things to think about:
Local projection, Filtering, Navigation – are these possible or bad ideas? Maybe after the holiday. Time to rest, but before I go:
The source code is available on Github in my Utility Pack:
EDIT (11/26/2014): Github Source for this moved to a different 1.4 Git Repo — Installable .ZIP can be found there, too.
entmike/DesignStudio1.4SDK · GitHub
Code specific to my Data Source Test component:
DesignStudio1.4SDK/dataTest.js at master · entmike/DesignStudio1.4SDK · GitHub
General SDK Installation instructions can be found here along with other examples:
Design Studio 1.2/1.3 SDK – Design Studio Utility Pack
Enjoy – and Happy Thanksgiving.
You are simply the best, Mike. The property name Mutator is so much better than Multiplier....:).... looking for other names like carcinogen soon...;)
enjoyed your work as always....thanks,
peter
Thanks, Peter 🙂
'Mutator' was the first word that came to mind, but 'Modifier' or 'Calculation' would have been a better fit. The idea being though a calculation component to modify/mutate a value, which in this case is just a simple multiplication factor so yes even 'Multiplier' would have been more accurate.
Carcinogen? I hope not! LOL
Would it be possible to use Datasource SDK to consume data provided with a Web Service?
What do you think about it?
Yes. But you could run into "same origin policy issues", if the Web Service uses a different URL than the one your BIAPP was loaded from.
In this case it is helpful if the Web Service is exposed by JSONP.
I was thinking about using WEBI block published as a web service as SDK datasource in DS 1.4.
Ok, this should work as in this case both, BIAPP and Webi Webservice are on the same host.
I hope its possible. I have made a blog post for that http://scn.sap.com/community/businessobjects-design-studio/blog/2014/12/04/custom-data-source-in-sap-design-studio-14
Thanks Mike for testing.
About your observations:
You could also create a dummy script, call DS_1.getData() and use content assist to create a valid selection string. Copy it from the script editor to the data selection property and you are done.
You could also use a Simple crosstab and use its getVisualSelection() method to get a valid selection string.
The data project feature of the SdkDataBuffer is also used to provide several nice BIAL scripting functions out of the box, including "setFilter", "clearFilter", "getData" and more.
Note that projection is a subset of filtering - which BICS-based data sources provide. Filtering could re-aggregate the data and produce different numbers. If you want to achieve something similar in a SDK data source, you need a little JS OLAP engine, e.g. crossfilter.
Thanks as always for your thoughtful answers and feedback! After the holiday I'll spend some more time thinking about these possibilities and perhaps someone else will pile on for some more good discussion.
That's great!
Thanks Mike!
One question, i'm working in a webservice connection with Ajax in a custom component, but the content type arrive in Blank to my ABAP RFC webservice. Do you know how can be the cause?
Thanks!
Ajax to ABAP? This will likely cause a "Same origin policy" violation, as ABAP is on a different host than the URL from which you page is loaded from.
Exist any option to allow it? similar to crossdomain file that i normally use with dashboard designer
I use this method:
$.Ajax{
url: <BW Host Abap RFC Webservice URI>
type: POST
datatype: "XML"
data: soapMessage
contentType: "text\xml"
.....
}
You can ignore my JSONP method suggestion if you use POST
Yes, and this is not allowed for browsers. For test purposes you can disable the checks, e.g. in Chrome by starting is with
--disable-web-security command line option.
But for real use you might need to use CORS or JSONP. For JSONP I hear so far that you can't simply use ABAP SOAP interfaces, but you would need to implement a HTTP handler in ABAP.
Reverse proxies
Domain Relaxation
JSONP
Serverside tunneling in same TLD
Hi Michael,
I just tried using DataSource CSV SDK. As you have mentioned it does not work with components like Crosstab. Just wanted to check with you if it would work with SimpleTable SDK component. I tried on that and still it did not work out.
Regards,
Sukanya
Hi Michael,
I tried to replicate the Test 2. When I try this, there is a error message in the belonging Chart: "No Data Available". Do you know why it doesn´t work for me? I also tried a local URL "C:\.." and it still doesn´t work.
It would be great if you can help me.
Regards,
Jasper
Hey Jasper,
The CSV source must be an http:// URL. If you use the URL to my website, the CSV file is still hosted there so you can see a successful test unless you are behind some firewall.
For local content like a CSV on your workstation, you'd have to run a webserver or something to expose it as http for consumption.
Maybe a better approach depending on your needs is to just use this custom datasource instead if you are just using local data:
Design Studio SDK (1.4) - Bring Your Own (BYO) Datasource
Hi Michael
I tried to recreate your Test 2 with your URL. It didn't work. Is there anything else I need to do to make this work without just:
1) Creating the csv data source
2) Adding your URL in the data source
3) Add a chart object with reference to the newly created data source
Kind regards
Erik
Hi Michael,
Loved the extension. Learnt quite a lot from the example. I'm still pretty new to Design Studio. I was wondering if you could help me out with a few things.
1. How did you add the BIAL method setMutator?
2. I am currently working on a data extension which retrieves data from a REST API via JSONP. Like the csvdatasource example, one of the properties is of the type URL. Is it possible to modify the URL at runtime using a BIAL script? If so how?
Thanks and regards,
Yash
Hi Michael,
great stuff!
I am currently about to use your datasource to be able to use fractions of accumulated values in DS (for UNX this works with e.g. WebI but DS so far lacks the database delegated support).
My question:
Is it somehow possible to use dimensions with members containing a comma?
So far everything is cut of after the first comma and I couldn't find a way to uote the comma so far.
Many thanks in advance.
Kind regards