Skip to main content

#Contact토론 중인 항목 0개

Tanushree Khadanga (khadangas) 님이 #Salesforce Developer에 글을 올렸습니다

Hello Team,

 

I am getting the following error - 

This page has an error. You might just need to refresh it. Action failed: c:ContactListSearch$controller$searchKeyChange [Cannot read properties of undefined (reading 'setParams')] Failing descriptor: {c:ContactListSearch$controller$searchKeyChange} 

while running the app with the following code.

 

QuickContacts.app

<aura:application>

    <link href='/resource/bootstrap/' rel="stylesheet"/>

    <div class="navbar navbar-default navbar-static-top" role="navigation">

        <div class="container">

            <div class="navbar-header">

                <a href="#" class="navbar-brand">Lightning Contacts</a>

            </div>

        </div>

    </div>

    <div class="container">

        <div class="row">

            <div class="col-sm-12">

                <c:ContactListSearch/>

                <c:ContactList/>

            </div>

        </div>

    </div>

</aura:application>

 

ContactList.cmp

<aura:component controller="ContactController">

    <aura:attribute name="contacts" type="Contact[]"/>

    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />

    <aura:handler event="c:SearchKeyEvent" action="{!c.searchKeyChange}"/>

    <ul class="list-group">

        <aura:iteration items="{!v.contacts}" var="contact">

            <li class="list-group-item">

                <a href="{! ' #contact/' + contact.Id }">

                    <p>{!contact.Name}</p>

                    <p>{!contact.Phone}</p>

                </a>

            </li>

        </aura:iteration>

    </ul>

</aura:component>

 

ContactListController.js

({

    doInit : function(component, event)

    {

        var action=component.get("c.findAll");

        action.setCallback(this,function(a)

                           {

                               component.set("v.contacts",a.getReturnValue());    

                           });

    $A.enqueueAction(action);

    },

    searchKeyChange: function(component, event) {

        var searchKey = event.getParam("searchKey");

        var action = component.get("c.findByName");

        action.setParams({

          "searchKey": searchKey

        });

        action.setCallback(this, function(a) {

            component.set("v.contacts", a.getReturnValue());

        });

        $A.enqueueAction(action);

    }

})

 

ContactListSearch.cmp

<aura:component >

    <input type="text" class="form-control" placeholder="Search" onkeyup="{!c.searchKeyChange}"/>

</aura:component>

 

SearchKeyEvent.evt

<aura:event type="APPLICATION" access="global">

    <aura:attribute name="searchKey" type="String"/>

</aura:event>

 

ContactListSearchController.js

({

        searchKeyChange : function(component, event, helper) {

        

        var myEvent = $A.get("e.c:SearchKeyChange");

        myEvent.setParams({"searchKey":event.target.value});

        myEvent.fire();

   

    }

    })

 

Can anyone please help me to find the error?

 

#Salesforce Developer

0/9000

I'm able to represent graphically what I'm after but I also want the ratio it represents and I'm having trouble generating that calculated field due to aggregate/non-aggregate LOD.

 

Trouble generating ratio in calculated field

 

My data looks something like this

Participant-CustContact IDStart Time

A

1456

Discrete m/dd/YY x:xx:xxA2587Discrete m/dd/YY x:xx:xxA3697Discrete m/dd/YY x:xx:xxB8965Discrete m/dd/YY x:xx:xxC7894Discrete m/dd/YY x:xx:xxD2469Discrete m/dd/YY x:xx:xxD3674Discrete m/dd/YY x:xx:xx

 

So far to count the number of Contacts per Participant or to get the degree of contact I've used 'FIXED CompleteID':

 

{FIXED [Participant Phone Number], [Segment Start Time]:

 

COUNTD([CompleteID])}

 

And I've gotten as far as distinguishing =1 from >1

 

IF SUM([FIXED CompleteID])=1

 

THEN 'Resolved'

 

ELSEIF SUM([FIXED CompleteID])>1

 

THEN 'Unresolved'

 

ELSE 'Null'

 

END

 

but I am somehow stuck when it comes to writing a calculated field that takes #Contact ID where degree =1/SUM(All Contact IDs).

In this example 2/7; .29

 

Count-Degree#Contact IDCustomer(s)

1

2

B,C22D33A40*.........

 

current+iteration.PNG

 

Have I complicated things with the FIXED expression unnecessarily, would I be better served by a window_count? What do I need to do to get that degree=1 ratio to all Contact IDs? Thanks.

 

Best regards,

Chad

답변 1개
  1. 2015년 10월 23일 오후 5:51

    hi Chad,

     

    Just looking at some unanswered questions and came across this one...

     

    I might need a bit more detail to get your exact solution, but I think you can do this using your current logic

     

    COUNTD(IIF([FIXED CompleteID]=1,[Contact ID],NULL)/{COUNTD([Contact ID])}

     

    by using [Contact ID] and Null the COUNTD function will only countd the Contact IDs (it doesn't count NULLs)

     

    btw {COUNTD([Contact ID])} is just short hand for FIXED when there are no Dimensions for the LoD. If you wanted this by Week, you'd do

     

    COUNTD(IIF([FIXED CompleteID]=1,[Contact ID],NULL)/{FIXED [Date]: COUNTD([Contact ID])}

     

    Hope this helps, and makes sense, but please post back if not.

0/9000