Skip to Content
0
Jul 29, 2016 at 11:29 AM

Complex data types in Design Studio SDK - ZTL functions

148 Views

Dear Design Studio SDK fellows! recently I stumbled across the new feature to define custom data types and arrays for the properties pane of SDK components. This is a really great enhancement that makes handling of parameters much easier for our customers! However, we are struggling a bit on how to enable setting these custom data types via ZTL methods. Has anyone done this before? Here is what we did so far:

1. We have defined the data types in the XML file to allow for manual input, which works absolutely fine:

2. It also works for the ZTL function getter, this is an example of a valid script to access the contents of the parameter:

OPENBIEXPORT_1.getPptVisibleComponentArray().forEach(function(element, index) {

var string = element.Component;

var bool = element.isExcluded;

});

The definition of the function is:

/**

Gets the Property "Visible Components" for PowerPoint Export.<br>

*/

com.biexcellence.openbi.sap.ExportVisibleComponentArray getPptVisibleComponentArray() {*

return this.pptVisible;

*}

/**

And the definition of the used object is:

/**

Array for Export Url Parameters

*/

class com.biexcellence.openbi.sap.ExportUrlParameterArray extends Array {

com.biexcellence.openbi.sap.ExportUrlParameterArray (com.biexcellence.openbi.sap.ExportUrlParameter h);

}

/**

Array Holder for Export Visible Components

*/

class com.biexcellence.openbi.sap.ExportVisibleComponent {

String Component;

boolean isExcluded;

}



3. Now the question is how we could fill the array programmatically?

I managed to retrieve an instance of the Array in the script via:

var elements = OPENBIEXPORT_1.getPptVisibleComponentArray();

I seem to be able to push new elements :

elements.push(element);

I now need an object of type com.biexcellence.openbi.sap.ExportVisibleComponent.

I cannot define this via a var statement in the script, can I?

This is why I created a method to return an empty element:

/**

Gets an empty "Visible Components" element.<br>

*/

com.biexcellence.openbi.sap.ExportVisibleComponent getVisibleComponentEmpty() {*

com.biexcellence.openbi.sap.ExportVisibleComponent lelement;

return lelement;

*}

/**

The element is recognized in my script method:

var element = OPENBIEXPORT_1.getVisibleComponentEmpty();

element.Component = "TEXT_1";

element.isExcluded = false;

However, the script shows the following message in both lines where I try to access the instance fields:


Getting this to work would really open a lot of opportunities for SDK development.

Really looking forward for the discussion with you on how to get this working!


All the best

Thilo

Attachments

sc1.jpg (22.5 kB)
sc2.jpg (8.3 kB)