• Mee Sharma
  • NEWBIE
  • 20 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 9
    Replies
I have 2 lightning tabs, each of them have a lightning data table in it.
1.The first tab displays a search filter and displays options accordingly
2.Each tab has a checkbox and you can select the options.
3.The 2nd tab displays all the selected options from the first tab.
4.There is a remove button against each row in 2nd tab
Requirement is:-
when I select an option from first tab data table--> display automatically in 2nd tab. when I remove an option from 2nd tab datatable--> uncheck it simultaneously from first tab datatable also.
My issue is:- When I remove an option it is not reflecting in the first tab datatable. However when I reselect category(onChange of category) I am able to see the updated options. How do I achieve this without having to reselect the category each time?

My code:-
component
<aura:component controller="SitePlanController" implements="flexipage:availableForAllPageTypes" access="global">
<aura:handler name="init" value="{!this}" action="{!c.onInit}" />

<lightning:card>
<lightning:layout multipleRows="true">
  <lightning:layoutItem size="9">

    <lightning:layoutItem size="4" class="slds-m-left_large">
        <lightning:tabset selectedTabId="{! v.selectedTabId}">
            <lightning:tab label="Add options" id="AO_view" onactive="{! c.handleActiveAO }">
            </lightning:tab>
            <lightning:tab label="Selected options" id="SO_view" onactive="{! c.handleActiveSO }" >
            </lightning:tab>
        </lightning:tabset>
    </lightning:layoutItem>

    <aura:if isTrue="{!v.selectedTabId == 'AO_view'}">
          
  <lightning:layoutItem size="1"></lightning:layoutItem>
  <lightning:layoutItem size="2">
    <lightning:select label="Category" aura:id="category_selector" class="slds-m-bottom_medium" onchange="{! c.onCategorySelect }" >
      <option value="">Select Category</option>
      <aura:iteration items="{! v.categories}" var="c">
        <option value="{!c.Id}" selected="{!c.Id == v.categoryId}" >{!c.Display_Name__c}</option>
      </aura:iteration>
    </lightning:select>
  </lightning:layoutItem>
  <lightning:layoutItem size="1"></lightning:layoutItem>
  <lightning:layoutItem size="3" class="slds-m-top_x-large">
    <p>{! v.instruction}</p>
  </lightning:layoutItem>

  <lightning:layoutItem size="8">
    <div class="slds-panel__body">
      <lightning:datatable columns="{! v.tableFields }" data="{! v.options }" keyField="id"
        onrowaction="{! c.showOptionDetail}" onrowselection="{! c.selectOption}"
        selectedRows="{! v.selectedRows}" />
    </div>
  </lightning:layoutItem>
  <lightning:layoutItem size="4">
    <aura:if isTrue="{! v.option}">
      <div
        class="slds-panel slds-panel_docked slds-panel_docked-right slds-is-open slds-text-align_center slds-m-right_medium slds-m-top_large"
        aria-hidden="false">
        <p class="slds-text-body_regular">{! v.option.description}</p>
        <img class="product_image slds-m-top_small" src="{!v.imgPrefixURL + v.option.imageId}" />
      </div>
    </aura:if>
  </lightning:layoutItem>
        

        <aura:set attribute="else">
            <aura:if isTrue="{!v.selectedTabId == 'SO_view'}">

              <lightning:layoutItem size="8">
                <div class="slds-panel__body">
                  <lightning:datatable aura:id="AOTable" columns="{! v.tableFieldsSO }" data="{! v.allUserSelectedOptions }" keyField="id"
                  hideCheckboxColumn ="true" onrowaction="{! c.removeRow}" />
                </div>
              </lightning:layoutItem>
                
            </aura:if>
            
        </aura:set>
    </aura:if>
</lightning:layoutItem>

</lightning:layout>
</lightning:card>
</aura:component>

Jscontroller
({
onInit: function (cmp, event, helper) {
   

    helper.showCategories(cmp);
},
showOptionDetail: function (cmp, event, helper) {
    var option = event.getParam("row"); 
    cmp.set("v.option", option);   
},
onCategorySelect: function (cmp, event, helper) {
    
    var categoryId = cmp.find("category_selector").get("v.value");
    cmp.set("v.categoryId", categoryId);
    cmp.set("v.selectedcategoryId",categoryId);

    if(categoryId){
        var categories = cmp.get("v.categories");
        var i=0;
        while(categories[i].Id != categoryId){i++;}
        cmp.set("v.instruction", categories[i].Instruction__c);
        helper.showOptions(cmp, categoryId);
    }else{
        cmp.set("v.options", []);
        cmp.set("v.instruction", "");
    }
},
selectOption: function (cmp, event, helper) {
    var categoryId = cmp.get("v.categoryId");
    var allSelectedOptions = cmp.get("v.allSelectedOptions");
    if(allSelectedOptions.length == 0){allSelectedOptions = [];}

    // Get selected option Ids 
    var selectedRows = event.getParam("selectedRows");
    console.log('c.selectop selectedRows'+selectedRows);
    if(selectedRows.length == 0){
        selectedRows = [];
    }else{
        var temp = [];
        selectedRows.forEach(function(option){
            temp.push(option.id);
        });
        selectedRows = temp;
    }
        
    //To get id of selected options
    cmp.set("v.selectedRowsId",selectedRows);
    //var c = cmp.get(v.selectedRowsId);
    //console.log('selectedRowsId'+c);
    


    // Replace options for current category with updated ones
    var i=0;
    while(i<allSelectedOptions.length && allSelectedOptions[i].categoryId != categoryId){i++;}
    if(i<allSelectedOptions.length){
        allSelectedOptions[i].categoryId = categoryId;
        allSelectedOptions[i].options = selectedRows;

        
    }else{
        allSelectedOptions.push({categoryId: categoryId, options: selectedRows});
    }
    cmp.set("v.allSelectedOptions", allSelectedOptions);

    var x = cmp.get('v.allSelectedOptions');

     console.log('allSelectedOptions'+x)
    
            
},

//loads content when the Selected options tab is selected
handleActiveSO: function (cmp, event, helper) {

    var s = cmp.get("v.selectedRowsId");
        cmp.set("v.selectedTabId", 'SO_view');
    helper.ShowAllUserSelectedoptions(cmp,s);


},

//loads content when the Add option tab is selected
handleActiveAO: function (cmp, event, helper) {
    
    $A.get('e.force:refreshView').fire();
    
    
},
    
//handle remove row action in 'selected options' tab
removeRow: function (cmp, event, helper){
    var action = event.getParam('action');
    var actname = action.name;
    var row = event.getParam('row');
    var categoryId = cmp.get("v.categoryId");
    

    if (actname === 'delete') {
        
        helper.removeOption(cmp, row);
    } 
}
})


Helper method
({
    showCategories: function (cmp) {
        
                cmp.set("v.categories", categories);
            }else {
                $A.log("callback error", res.getError());
            }
        });
        $A.enqueueAction(action);
    },
    showOptions: function (cmp, categoryId) {
        var action = cmp.get("c.getOptions");
        action.setParams({"categoryId": categoryId});
        action.setCallback(this, function (res) {
            var state = res.getState();
            if (state === "SUCCESS") {
                var options = res.getReturnValue();
                cmp.set("v.options", options);
                this.showSelectedOptions(cmp, categoryId);
            }
        $A.enqueueAction(action);
    },
    showSelectedOptions: function (cmp, categoryId) {
        var allSelectedOptions = cmp.get("v.allSelectedOptions");
        
        var i=0;
        while(i<allSelectedOptions.length && allSelectedOptions[i].categoryId != categoryId){i++;}
        if(allSelectedOptions[i] && allSelectedOptions[i].options){
            cmp.set("v.selectedRows", allSelectedOptions[i].options);
        }
        var x = cmp.get("v.selectedRows");
      
      
    },

    ShowAllUserSelectedoptions: function(cmp,userselectedoptionIds){

      
        var action = cmp.get("c.getallUserSelectedOptions");
        action.setParams({"userselectedoptionIds": userselectedoptionIds});
        action.setCallback(this, function (res) {
            var state = res.getState();
            if (state === "SUCCESS") {
                var useroptions = res.getReturnValue();
                cmp.set("v.allUserSelectedOptions", useroptions);
                
            }e

    removeOption: function (cmp, row) {

        var removedrowid = row.id;
              
        var rows = cmp.get('v.allUserSelectedOptions');
        var AOrows = cmp.get('v.allSelectedOptions');
       var SOrowId = cmp.get('v.selectedRows');
       
         //remove row from 'selected options' tab
        var rowIndex = rows.indexOf(row);
        rows.splice(rowIndex, 1);
        cmp.set('v.allUserSelectedOptions', rows);
       
             
           
                    
            //remove row from 'Add options' tab
            for(var i = 0; i < SOrowId.length; i++){
                if(SOrowId[i] == removedrowid){
                    SOrowId.splice(i, 1);
                    cmp.set("v.selectedRows", SOrowId);
                    cmp.set("v.selectedRowsId",SOrowId );
                    cmp.set("v.allSelectedOptions",SOrowId);
                }  
                
            }

         

           
        
    }
})
 
I have a requirement where i need to merge all accounts if a particular field vendor_code__c value is duplicate.There is also a condition that the account of record type 'A' needs to be the master and record type 'B' needs to be the dupliacte. I have written  a batch code for this fucntionality.I am not getting any errors but the accounts are not getting merged either. Kindly help!

global class BatchVendorAccountMerge implements database.Batchable<sobject>   {

    global  database.QueryLocator start(Database.BatchableContext ctx){
        string query;
        query = 'SELECT Id, Type, RecordTypeId,Record_Type__c, Name, MasterRecordId, Vendor_Code__c FROM Account';
                   
        return database.getQuerylocator(query);
        
    }
    
    global void execute(Database.BatchableContext BC, list<account> scope ){
        
     //create a map with vendor code and its account        
            
        //to store all unique vendor codes
        Set<string> strVC = new Set<string>();
        
         //create a map with vendor code and its account        
        map<string,list<account>> vendoraccmap = new map<string,list<account>>();
        
        
        for(account a:scope){
            
            strVC.add(a.Vendor_Code__c);
                        
            if(vendoraccmap.containskey(a.Vendor_Code__c)) {
              vendoraccmap.get(a.Vendor_Code__c).add(a);
            } else {
                vendoraccmap.put(a.Vendor_Code__c, new List<account> {a});
           
        } 
        }
       system.debug('****Unique vendor codes***'+strVC);
        system.debug('****vendor and acc map***'+vendoraccmap);
        
       Account masteracc = new account();
        list<account> dupacc = new list<account>();
            
        for(string v:vendoraccmap.keySet()){
            if(vendoraccmap.get(v).size() > 1)               
                
            
                system.debug('**vendoraccmapsize**'+vendoraccmap.get(v).size());
            {  
          
                for(Account a:vendoraccmap.get(v)) 
                {
                    if(a.Record_Type__c == 'A'){
                        masteracc.id=a.id;
                    }
                     else  if (a.Record_Type__c == 'B') {
                        dupacc.add(a);
                    }
                    
                     
                }
                
                system.debug('***Master account***'+masteracc);
                system.debug('***Duplicate accounts***'+dupacc);
            }
        }
        
        
        Database.MergeResult[] results = Database.merge(masteracc, dupacc, false);
      
        
        
     system.debug('***results merged**'+results);
        
       for(Database.MergeResult res : results) {
          if (res.isSuccess()) {
              System.debug('Master record ID: ' + res.getId());
        System.assertEquals(masteracc.Id, res.getId());               
        
      
        List<Id> mergedIds = res.getMergedRecordIds();
        System.debug('IDs of merged records: ' + mergedIds);                
        
                   
    }
    else {
        for(Database.Error err : res.getErrors()) {
            
            System.debug(err.getMessage());
        }
       }
    
     }
    }
    
    
     global void finish(Database.BatchableContext BC){
         
    }

    
    
}
My requirement is that when i check the checkboxes and click on delete button the records need to be deleted.
I am getting the following error while trying to click on delete button(created in parent cmp) which accesses the delete method in its child component.
Please help as I am not able to find out what is wrong..

"This page has an error. You might just need to refresh it. Action failed: c:Budgetdisplay$controller$delparent [chn.deletemethod is not a function] Failing descriptor: {c:Budgetdisplay$controller$delparent}"

Parent component
<aura:component>
<table>
<thead>
<!--data table-columns--->
 <lightning:button label="Delete"                         
                          variant="brand"
                          onclick="{!c.delparent}"/>                         
             
                    </thead> 
    <!-- ITERATION -->
             <tbody>
                      <aura:iteration items="{!v.expense}" var="e" indexVar="sNo">
                       <!-- Child Lightning Component --> 
                    <c:inlineedit aura:id ="inline" singleRec="{!e}"
                                     showSaveCancelBtn="{!v.showSaveCancelBtn}"
                                     sNo="{!sNo + 1}" />
            </aura:iteration>
</tbody>
</table>
</aura:component>

parent controller

delparent : function(component,event,helper){
      var chn = component.find("inline");
        chn.deletemethod();
    }

child component
<aura:component>
 <!--Table Row Start-->  
        <aura:method name="deletemethod" action = "{!c.delete}" access="global"/>       
       <tr class="slds-hint-parent" >
           <td>
           <ui:inputCheckbox aura:id="eachbox" text="{!v.singleRec.Id}" />
           </td>
    <!---other rows--->
         </tr>
</aura:component>

child controller
delete :function(component, event, helper){
    
    var delid = [];
    var getAllId = component.find("eachbox");
    console.log('getallid'+getAllId);
    
    if(! Array.isArray(getAllId)){
         if (getAllId.get("v.value") == true) {
           delid.push(getAllId.get("v.text"));
         }
     }
else{
      for (var i = 0; i < getAllId.length; i++) {
       if (getAllId[i].get("v.value") == true) {
         delid.push(getAllId[i].get("v.text"));
       }
      }
     }      
  
    console.log('testdelid'+delid);
    helper.deleteSelectedHelper(component, event, delid);
      
      },
    
Below is my lightning component that displays a table of expenses__c records based on a filter. I am trying to include an edit button for each row of the table so that when i click on it it redirects to the respective record edit page.

But i am getting the following error--"Action failed: c:Budgetdisplay$controller$edit [Cannot read property 'setParams' of undefined] Failing descriptor: {c:Budgetdisplay$controller$edit}"

Budgetdisplay.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global"  controller="budgetlightningcntrl" >
    <aura:attribute name="expense" type="Expenses__c[]"/>
    <aura:attribute name="allExpenses" type="Expenses__c[]" />
         
   <aura:handler event="c:statussearchkey" action="{!c.searchKeyChange}"/>
   <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>

 <!-- PAGE HEADER -->
    
     <table >
               <!--Search component-->
                          
                      <tr>
                         <th scope="col" ><div class=" slds-text-align--left">Edit</div></th>
                        <th scope="col" ><div class=" slds-text-align--left">Expenses ID</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Amount</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Status</div></th>
                        <th scope="col"><div class="slds-truncate slds-text-align--right">My Budget</div></th>
                       </tr>
                    </thead> 
    
             <tbody>
                      <aura:iteration items="{!v.expense}" var="e">
                       <tr class="slds-hint-parent" >
                           <td> 
                               <lightning:button label="Edit Record" onclick="{!c.edit}"/>
    
                           </td>
                              <td scope="row">
                                <div class="slds-truncate slds-text-align--left" >
                                <a target="_blank" href="{!'/'+e.Id}">{!e.Name}</a>                                 
                                </div>
                                </td>
                            <td scope="row">
                            <div class="slds-truncate slds-text-align--right"><ui:outputNumber value="{!e.Amount__c}"/></div>
                            </td>
                            <td scope="row">
                            <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Status__c}" /></div>                            
                            </td>
                            <td>
                            <div class="slds-truncate slds-text-align--right">
                            <button type="button" onclick="{!c.navigate}" id="{!e.Budget__c}">check Budget</button> 
                            </div>
                          </td>
                     </tr>            
            </aura:iteration>
          </tbody>         
       </table>
    </aura:component>

Budgetdisplaycontroller.js
({
    doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getexpense");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.expense", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},
    
    searchKeyChange : function(component, event, helper){
    helper.findByName(component,event); 
}
  , 
     edit : function(component, event, helper) {
    var editRecordEvent  = $A.get("e.force:editRecord");
    editRecordEvent.setParams({

        "recordId" : component.get("v.expense.Id")

    });

    editRecordEvent .fire();

}
,
    navigate: function(component, event, helper) {
  var idx = event.currentTarget.id;
    var naviEvt = $A.get("e.force:navigateToSObject");
        if (naviEvt){
              naviEvt.setParams({
                 "recordId": idx ,
                 "slideDevName": "detail"
                });

                   naviEvt.fire();
                   }
                  else{
                      window.location.href = "/" + idx;
                  }

}
  
    
})

 
I am very new to lightning and have a basic issue with creating a button. My requirement is that when i click on 'check my budget' button it should redirect me to the corresponding budget record of that expense.
Budget-Master object; Expense-detail object

Budgetdisplay.cmp
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" controller="budgetlightningcntrl" >
    <aura:attribute name="expense" type="Expenses__c[]"/>
    <aura:attribute name="spinner" type="Boolean" default="false"/>
    <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>    
    <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>     
  <aura:handler event="force:navigateToSObject" action="{!c.navigate}"/>   
   <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
  <aura:if isTrue="{!v.spinner}">
    <div aura:id="spinnerId" class="slds-spinner_container">
       <div class="slds-spinner--brand  slds-spinner slds-spinner--large slds-is-relative" role="alert">
         <span class="slds-assistive-text">Loading</span>
         <div class="slds-spinner__dot-a"></div>
         <div class="slds-spinner__dot-b"></div>
       </div>
    </div>
 </aura:if>
        
    <table class="slds-p-around_x-small slds-text-body_small slds-table slds-table--bordered slds-table--fixed-layout " >
                <thead>
                    <tr>                        
                        <th scope="col" colspan="3" class="slds-truncate slds-text-align--center slds-text-align--center 
                                                           slds-text-align_right slds-text-heading_medium">My Budget and Expenses</th>
                    </tr>
                    <tr>                        
                        <th scope="col"><div class="slds-truncate ">My Budget</div></th>
                        <th scope="col" ><div class=" slds-text-align--center">Expenses ID</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Amount</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Status</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Mode of Travel</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Date of Expense</div></th>
                    </tr>
                </thead> 
        <tbody>
            <aura:iteration items="{!v.expense}" var="e">
                <tr class="slds-hint-parent" >
                    <td>
                        <button type="button" onclick="{!c.navigate}" id="{!e.Budget__r.Id}">check Budget</button>                      
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right" >
                                <a target="_blank" href="{!'/'+e.Id}">{!e.Name}</a>                                 
                                </div>
                                </td>
                            <td scope="row">
                                 <div class="slds-truncate slds-text-align--right"><ui:outputNumber value="{!e.Amount__c}"/></div>
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Status__c}" /></div>                            
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Mode_of_Travel__c}"/></div>
                            </td>  
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputDate value="{!e.Date_of_Expense__c}"/></div>
                            </td>
                        </tr>            
            </aura:iteration>
          </tbody>
       </table>
</aura:component>

Budgetdisplaycontroller.js
({
    doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getexpense");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.expense", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},

    navigate: function(component, event, helper) {
  var idx = event.currentTarget.id;
    var navEvt = $A.get("e.force:navigateToSObject");
    navEvt.setParams({
      "recordId": idx
        });
    navEvt.fire();

}
,
    showSpinner: function(component,event,helper){
        component.set("v.spinner",true);
    },
    
    hideSpinner: function(component,event,helper){
        component.set("v.spinner",false);
    }
    
})
I have a requirement where i need to merge all accounts if a particular field vendor_code__c value is duplicate.There is also a condition that the account of record type 'A' needs to be the master and record type 'B' needs to be the dupliacte. I have written  a batch code for this fucntionality.I am not getting any errors but the accounts are not getting merged either. Kindly help!

global class BatchVendorAccountMerge implements database.Batchable<sobject>   {

    global  database.QueryLocator start(Database.BatchableContext ctx){
        string query;
        query = 'SELECT Id, Type, RecordTypeId,Record_Type__c, Name, MasterRecordId, Vendor_Code__c FROM Account';
                   
        return database.getQuerylocator(query);
        
    }
    
    global void execute(Database.BatchableContext BC, list<account> scope ){
        
     //create a map with vendor code and its account        
            
        //to store all unique vendor codes
        Set<string> strVC = new Set<string>();
        
         //create a map with vendor code and its account        
        map<string,list<account>> vendoraccmap = new map<string,list<account>>();
        
        
        for(account a:scope){
            
            strVC.add(a.Vendor_Code__c);
                        
            if(vendoraccmap.containskey(a.Vendor_Code__c)) {
              vendoraccmap.get(a.Vendor_Code__c).add(a);
            } else {
                vendoraccmap.put(a.Vendor_Code__c, new List<account> {a});
           
        } 
        }
       system.debug('****Unique vendor codes***'+strVC);
        system.debug('****vendor and acc map***'+vendoraccmap);
        
       Account masteracc = new account();
        list<account> dupacc = new list<account>();
            
        for(string v:vendoraccmap.keySet()){
            if(vendoraccmap.get(v).size() > 1)               
                
            
                system.debug('**vendoraccmapsize**'+vendoraccmap.get(v).size());
            {  
          
                for(Account a:vendoraccmap.get(v)) 
                {
                    if(a.Record_Type__c == 'A'){
                        masteracc.id=a.id;
                    }
                     else  if (a.Record_Type__c == 'B') {
                        dupacc.add(a);
                    }
                    
                     
                }
                
                system.debug('***Master account***'+masteracc);
                system.debug('***Duplicate accounts***'+dupacc);
            }
        }
        
        
        Database.MergeResult[] results = Database.merge(masteracc, dupacc, false);
      
        
        
     system.debug('***results merged**'+results);
        
       for(Database.MergeResult res : results) {
          if (res.isSuccess()) {
              System.debug('Master record ID: ' + res.getId());
        System.assertEquals(masteracc.Id, res.getId());               
        
      
        List<Id> mergedIds = res.getMergedRecordIds();
        System.debug('IDs of merged records: ' + mergedIds);                
        
                   
    }
    else {
        for(Database.Error err : res.getErrors()) {
            
            System.debug(err.getMessage());
        }
       }
    
     }
    }
    
    
     global void finish(Database.BatchableContext BC){
         
    }

    
    
}
My requirement is that when i check the checkboxes and click on delete button the records need to be deleted.
I am getting the following error while trying to click on delete button(created in parent cmp) which accesses the delete method in its child component.
Please help as I am not able to find out what is wrong..

"This page has an error. You might just need to refresh it. Action failed: c:Budgetdisplay$controller$delparent [chn.deletemethod is not a function] Failing descriptor: {c:Budgetdisplay$controller$delparent}"

Parent component
<aura:component>
<table>
<thead>
<!--data table-columns--->
 <lightning:button label="Delete"                         
                          variant="brand"
                          onclick="{!c.delparent}"/>                         
             
                    </thead> 
    <!-- ITERATION -->
             <tbody>
                      <aura:iteration items="{!v.expense}" var="e" indexVar="sNo">
                       <!-- Child Lightning Component --> 
                    <c:inlineedit aura:id ="inline" singleRec="{!e}"
                                     showSaveCancelBtn="{!v.showSaveCancelBtn}"
                                     sNo="{!sNo + 1}" />
            </aura:iteration>
</tbody>
</table>
</aura:component>

parent controller

delparent : function(component,event,helper){
      var chn = component.find("inline");
        chn.deletemethod();
    }

child component
<aura:component>
 <!--Table Row Start-->  
        <aura:method name="deletemethod" action = "{!c.delete}" access="global"/>       
       <tr class="slds-hint-parent" >
           <td>
           <ui:inputCheckbox aura:id="eachbox" text="{!v.singleRec.Id}" />
           </td>
    <!---other rows--->
         </tr>
</aura:component>

child controller
delete :function(component, event, helper){
    
    var delid = [];
    var getAllId = component.find("eachbox");
    console.log('getallid'+getAllId);
    
    if(! Array.isArray(getAllId)){
         if (getAllId.get("v.value") == true) {
           delid.push(getAllId.get("v.text"));
         }
     }
else{
      for (var i = 0; i < getAllId.length; i++) {
       if (getAllId[i].get("v.value") == true) {
         delid.push(getAllId[i].get("v.text"));
       }
      }
     }      
  
    console.log('testdelid'+delid);
    helper.deleteSelectedHelper(component, event, delid);
      
      },
    
Below is my lightning component that displays a table of expenses__c records based on a filter. I am trying to include an edit button for each row of the table so that when i click on it it redirects to the respective record edit page.

But i am getting the following error--"Action failed: c:Budgetdisplay$controller$edit [Cannot read property 'setParams' of undefined] Failing descriptor: {c:Budgetdisplay$controller$edit}"

Budgetdisplay.cmp
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global"  controller="budgetlightningcntrl" >
    <aura:attribute name="expense" type="Expenses__c[]"/>
    <aura:attribute name="allExpenses" type="Expenses__c[]" />
         
   <aura:handler event="c:statussearchkey" action="{!c.searchKeyChange}"/>
   <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>

 <!-- PAGE HEADER -->
    
     <table >
               <!--Search component-->
                          
                      <tr>
                         <th scope="col" ><div class=" slds-text-align--left">Edit</div></th>
                        <th scope="col" ><div class=" slds-text-align--left">Expenses ID</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Amount</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Status</div></th>
                        <th scope="col"><div class="slds-truncate slds-text-align--right">My Budget</div></th>
                       </tr>
                    </thead> 
    
             <tbody>
                      <aura:iteration items="{!v.expense}" var="e">
                       <tr class="slds-hint-parent" >
                           <td> 
                               <lightning:button label="Edit Record" onclick="{!c.edit}"/>
    
                           </td>
                              <td scope="row">
                                <div class="slds-truncate slds-text-align--left" >
                                <a target="_blank" href="{!'/'+e.Id}">{!e.Name}</a>                                 
                                </div>
                                </td>
                            <td scope="row">
                            <div class="slds-truncate slds-text-align--right"><ui:outputNumber value="{!e.Amount__c}"/></div>
                            </td>
                            <td scope="row">
                            <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Status__c}" /></div>                            
                            </td>
                            <td>
                            <div class="slds-truncate slds-text-align--right">
                            <button type="button" onclick="{!c.navigate}" id="{!e.Budget__c}">check Budget</button> 
                            </div>
                          </td>
                     </tr>            
            </aura:iteration>
          </tbody>         
       </table>
    </aura:component>

Budgetdisplaycontroller.js
({
    doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getexpense");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.expense", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},
    
    searchKeyChange : function(component, event, helper){
    helper.findByName(component,event); 
}
  , 
     edit : function(component, event, helper) {
    var editRecordEvent  = $A.get("e.force:editRecord");
    editRecordEvent.setParams({

        "recordId" : component.get("v.expense.Id")

    });

    editRecordEvent .fire();

}
,
    navigate: function(component, event, helper) {
  var idx = event.currentTarget.id;
    var naviEvt = $A.get("e.force:navigateToSObject");
        if (naviEvt){
              naviEvt.setParams({
                 "recordId": idx ,
                 "slideDevName": "detail"
                });

                   naviEvt.fire();
                   }
                  else{
                      window.location.href = "/" + idx;
                  }

}
  
    
})

 
I am very new to lightning and have a basic issue with creating a button. My requirement is that when i click on 'check my budget' button it should redirect me to the corresponding budget record of that expense.
Budget-Master object; Expense-detail object

Budgetdisplay.cmp
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" controller="budgetlightningcntrl" >
    <aura:attribute name="expense" type="Expenses__c[]"/>
    <aura:attribute name="spinner" type="Boolean" default="false"/>
    <aura:handler event="aura:waiting" action="{!c.showSpinner}"/>    
    <aura:handler event="aura:doneWaiting" action="{!c.hideSpinner}"/>     
  <aura:handler event="force:navigateToSObject" action="{!c.navigate}"/>   
   <aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
    
  <aura:if isTrue="{!v.spinner}">
    <div aura:id="spinnerId" class="slds-spinner_container">
       <div class="slds-spinner--brand  slds-spinner slds-spinner--large slds-is-relative" role="alert">
         <span class="slds-assistive-text">Loading</span>
         <div class="slds-spinner__dot-a"></div>
         <div class="slds-spinner__dot-b"></div>
       </div>
    </div>
 </aura:if>
        
    <table class="slds-p-around_x-small slds-text-body_small slds-table slds-table--bordered slds-table--fixed-layout " >
                <thead>
                    <tr>                        
                        <th scope="col" colspan="3" class="slds-truncate slds-text-align--center slds-text-align--center 
                                                           slds-text-align_right slds-text-heading_medium">My Budget and Expenses</th>
                    </tr>
                    <tr>                        
                        <th scope="col"><div class="slds-truncate ">My Budget</div></th>
                        <th scope="col" ><div class=" slds-text-align--center">Expenses ID</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Amount</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Status</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Mode of Travel</div></th>
                        <th scope="col"><div class="slds-truncate  slds-text-align--right">Date of Expense</div></th>
                    </tr>
                </thead> 
        <tbody>
            <aura:iteration items="{!v.expense}" var="e">
                <tr class="slds-hint-parent" >
                    <td>
                        <button type="button" onclick="{!c.navigate}" id="{!e.Budget__r.Id}">check Budget</button>                      
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right" >
                                <a target="_blank" href="{!'/'+e.Id}">{!e.Name}</a>                                 
                                </div>
                                </td>
                            <td scope="row">
                                 <div class="slds-truncate slds-text-align--right"><ui:outputNumber value="{!e.Amount__c}"/></div>
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Status__c}" /></div>                            
                            </td>
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputText value="{!e.Mode_of_Travel__c}"/></div>
                            </td>  
                            <td scope="row">
                                <div class="slds-truncate slds-text-align--right"><ui:outputDate value="{!e.Date_of_Expense__c}"/></div>
                            </td>
                        </tr>            
            </aura:iteration>
          </tbody>
       </table>
</aura:component>

Budgetdisplaycontroller.js
({
    doInit: function(component, event, helper) {

    // Create the action
    var action = component.get("c.getexpense");

    // Add callback behavior for when response is received
    action.setCallback(this, function(response) {
        var state = response.getState();
        if (component.isValid() && state === "SUCCESS") {
            component.set("v.expense", response.getReturnValue());
        }
        else {
            console.log("Failed with state: " + state);
        }
    });

    // Send action off to be executed
    $A.enqueueAction(action);
},

    navigate: function(component, event, helper) {
  var idx = event.currentTarget.id;
    var navEvt = $A.get("e.force:navigateToSObject");
    navEvt.setParams({
      "recordId": idx
        });
    navEvt.fire();

}
,
    showSpinner: function(component,event,helper){
        component.set("v.spinner",true);
    },
    
    hideSpinner: function(component,event,helper){
        component.set("v.spinner",false);
    }
    
})
This forum is my last resort before reaching out to our Dev partner, hoping someone can help me figure this out as SFDC support has been a nightmare so far.

What I have:
Right now I have a Flow built that works off of checkboxes on the opportunity and also fields in a custom setting. What it does is say there are 5 checkboxes that relate to legal language. The rep checks off which lines of language they need inserted in the contract and when they click save it takes the 1-5 lines they selected and add it to one text area field called "special Notes". To get thos to work I built a flow that uses the ADD function in an assignment element (Not Equals). It works great except it takes all the spaces out and shows as one chunk of text. I'd love for it to add each line on it's own line. NOTE: I can't use concatenate or Equals because it can be any combination of language so it might be one line on this contract and 3 on the next and 4 on the next and so on.

What I tried already:
I tried adding every line break code I could come across, HTML and formulas code ( BR() ) without any success. I also read a post on this forum about how to use a text template but that only works for concatenate scenarios. I also tried to add a blank variable with just a space in it and that didn't work either, it removed the space.

I think the issue is the custom setting as I don't think that respects formula codes or HTML, but the SFDC rep said that flows do support HTML.

Any help would be greatly appreciated. I'm down to try things out too, don't hesitate to throw out any unproven ideas.

Thanks for your thought and future responses
I have a text formula to which I would like to add a carriage return/line break.  I tried concatenating chr(13) and chr(10), but the validation didn't like it.  Is this possible?