Skip to content

Instantly share code, notes, and snippets.

@gundisalwa
Last active August 29, 2015 14:07
Show Gist options
  • Save gundisalwa/aa1ee2173625f6e62368 to your computer and use it in GitHub Desktop.
Save gundisalwa/aa1ee2173625f6e62368 to your computer and use it in GitHub Desktop.
Unmanaged Query Component (CDF)

Unmanaged Query Component

Description

Adds a simple version of a query component but that runs asynchronously, extending the base asynchronous component class for CDF, Unmanaged Component.

Instalation

  • Create a folder inside JCR on /public/cde/components (I suggest naming the folder UnmanagedQueryComponent).
  • Drop the two component files there.
  • Refresh CDF cache or restart BA server.
var UnmanagedQueryComponent = UnmanagedComponent.extend({
visible: false,
update : function() {
var cd = this.queryDefinition;
this.triggerQuery(cd,_.bind(this.render, this));
},
render: function(data){
if (this.resultvar != undefined){
Dashboards.setParameter(this.resultvar, data.resultset);
}
}
});
<?xml version="1.0"?>
<DesignerComponent>
<Header>
<Name>Unmanaged Query Component</Name>
<IName>unmanagedQueryComponent</IName>
<Description>Unmanaged Query Component</Description>
<Category>OTHERCOMPONENTS</Category>
<CatDescription>Others</CatDescription>
<Type>PalleteEntry</Type>
<Version>1.0</Version>
</Header>
<Contents>
<Model>
<Property name="parameters">xActionArrayParameter</Property>
<Definition name="queryDefinition">
<Property>dataSource</Property>
</Definition>
<Property>resultvar</Property>
<Property>executeAtStart</Property>
<Property>listeners</Property>
<Property>htmlObject</Property>
<Property>preExecution</Property>
<Property>postExecution</Property>
<Property>postFetch</Property>
<Property>refreshPeriod</Property>
<Property>tooltip</Property>
</Model>
<Implementation>
<Code src="component.js"/>
</Implementation>
</Contents>
</DesignerComponent>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment