You need to sign in to do that
Don't have an account?
Prathima Maradala 3
Lightning communication with Einstien dashboard.
Hello All ,
I am facing a problem while filtering a wave dashboard from a lightning component . Do I need any SDK license for wave:update event to trigger?
below is my code .Please let me know if I am going wrong any where?
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="evtValue" type ="String" access="GLOBAL" />
<aura:attribute name="eqpmtNumb" type="String" access="GLOBAL"/>
<aura:attribute name ="dashboardId" type="String" access="GLOBAL" default="0FK1D000000001OWAQ"/>
<aura:attribute name="developerName" type="String" access="GLOBAL" default=""/>
<!--<aura:handler name="init" value= "{!this}" action="{!c.doInit}" /> -->
<aura:registerEvent name="update" type="wave:update"/>
<lightning:input type="input" label="EVT_CD" aura:id="evt" value="{!v.evtValue}"/>
<lightning:input type="input" label="EQPMT_NUMB" aura:id="eqpmt" value="{!v.eqpmtNumb}" />
<lightning:button variant="brand" label="Get data" title="Clicki To Refresh Data" onclick="{!c.handleUpdate}" />
</aura:component>
Controller:
({ handleUpdate: function(component, event, type)
{
var getEvtVal = component.find("evt").get("v.value");
var getEqpmtVal= component.find("eqpmt").get("v.value");
var dashboardId ='0FK1D000000001OWAQ';
alert('getEvtVal '+getEvtVal);
alert('getEqpmtval '+getEqpmtVal);
if(getEvtVal != null || getEqpmtVal != undefined)
{
helper.evtFilter(component);
var event = $A.get('e.wave:update');
event.setParams({
id:dashboardId,
value:getEvtVal,
type:"dashboard"
}
);
event.fire();
}
if(getEqpmtVal != null || getEvtVal !=undefined)
{
helper.eqpmtFilter(component);
var event = $A.get('e.wave:update');
event.setparams({
id:dahboardId,
value:getEqpmtVal,
type: "dashboard"
});
event.fire();
}
}
})
Helper:
({
evtFilter : function(component, event, helper) {
var getEvtVal = component.find("evt").get("v.value");
var evtFilter = {
datasets: {
"Unit_Tracing": [{
fields: [
"EVT_CD"
],
evtFilter: {
operator: "in",
values:[
getEvtval
]
}
}]
}
};
var evtFilterJSON = JSON.stringify(evtFilter);
component.set("v.evtValue",evtFilterJSON);
},
eqpmtFilter : function(component, event, helper) {
var getEqpmtVal = component.find("eqpmt").get("v.value");
var eqpmtFilter = {
datasets: {
"Unit_Tracing": [{
fields: [
"EQPMT_NUMB"
],
eqpmtFilter: {
operator: "in",
values:[
getEqpmtval
]
}
}]
}
};
var eqpmtFilterJSON = JSON.stringify(eqpmtFilter);
component.set("v.eqpmtValue",eqpmtFilterJSON);
},
})
I am facing a problem while filtering a wave dashboard from a lightning component . Do I need any SDK license for wave:update event to trigger?
below is my code .Please let me know if I am going wrong any where?
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="evtValue" type ="String" access="GLOBAL" />
<aura:attribute name="eqpmtNumb" type="String" access="GLOBAL"/>
<aura:attribute name ="dashboardId" type="String" access="GLOBAL" default="0FK1D000000001OWAQ"/>
<aura:attribute name="developerName" type="String" access="GLOBAL" default=""/>
<!--<aura:handler name="init" value= "{!this}" action="{!c.doInit}" /> -->
<aura:registerEvent name="update" type="wave:update"/>
<lightning:input type="input" label="EVT_CD" aura:id="evt" value="{!v.evtValue}"/>
<lightning:input type="input" label="EQPMT_NUMB" aura:id="eqpmt" value="{!v.eqpmtNumb}" />
<lightning:button variant="brand" label="Get data" title="Clicki To Refresh Data" onclick="{!c.handleUpdate}" />
</aura:component>
Controller:
({ handleUpdate: function(component, event, type)
{
var getEvtVal = component.find("evt").get("v.value");
var getEqpmtVal= component.find("eqpmt").get("v.value");
var dashboardId ='0FK1D000000001OWAQ';
alert('getEvtVal '+getEvtVal);
alert('getEqpmtval '+getEqpmtVal);
if(getEvtVal != null || getEqpmtVal != undefined)
{
helper.evtFilter(component);
var event = $A.get('e.wave:update');
event.setParams({
id:dashboardId,
value:getEvtVal,
type:"dashboard"
}
);
event.fire();
}
if(getEqpmtVal != null || getEvtVal !=undefined)
{
helper.eqpmtFilter(component);
var event = $A.get('e.wave:update');
event.setparams({
id:dahboardId,
value:getEqpmtVal,
type: "dashboard"
});
event.fire();
}
}
})
Helper:
({
evtFilter : function(component, event, helper) {
var getEvtVal = component.find("evt").get("v.value");
var evtFilter = {
datasets: {
"Unit_Tracing": [{
fields: [
"EVT_CD"
],
evtFilter: {
operator: "in",
values:[
getEvtval
]
}
}]
}
};
var evtFilterJSON = JSON.stringify(evtFilter);
component.set("v.evtValue",evtFilterJSON);
},
eqpmtFilter : function(component, event, helper) {
var getEqpmtVal = component.find("eqpmt").get("v.value");
var eqpmtFilter = {
datasets: {
"Unit_Tracing": [{
fields: [
"EQPMT_NUMB"
],
eqpmtFilter: {
operator: "in",
values:[
getEqpmtval
]
}
}]
}
};
var eqpmtFilterJSON = JSON.stringify(eqpmtFilter);
component.set("v.eqpmtValue",eqpmtFilterJSON);
},
})