• TUSHAR KHORGADE
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 1
    Replies
System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []

public with sharing class InvestmentController {
   
@AuraEnabled(cacheable=true)
public static List<HSA_Investment__c> fetchInvestment() {
List<HSA_Investment__c> invest = [SELECT Id,Name,Company_Sector__r.Name,Fund_Released_Date__c
FROM HSA_Investment__c];
System.debug('In the fetch ' +invest );
return invest;
}

@auraEnabled
public static void savePriceValue(List<Integer> InvestmentPrice){
System.debug('check me ' + InvestmentPrice);
    List<HSA_Investment__c> priceUpdate = new List<HSA_Investment__c>();
    for(Integer i=0; i<InvestmentPrice.size(); i++){
        HSA_Investment__c empCardObj = new  HSA_Investment__c();
        empCardObj.NAV__c= InvestmentPrice[i];
       
        priceUpdate.add(empCardObj);
        }
        system.debug('price updateddd'+ priceUpdate);
       
    update priceUpdate;
    //return priceUpdate;
}
}
System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
i am getting above error when i want to update NAV value of Investment object from price input field in MF list
Create a map populate it with two records Odd and Even. Run a loop from 1-50, if you find an even number increase the count for an even named record in the map or else increase the count of odd named record. Odd and even are keys, counts are values. Example map syntax: Map<String,integer> CountNumber = new map<String,Inetger>({'Even':4},{'Odd':3});

my code is this

public class NumberTest {
    integer oddCount = 0;
    integer evenCount = 0;
    
    Map<string,integer> countNumber = new Map<string,integer>();
    
    for(int i=1;i<=50;i++)
    {
        if(a[i] % 2 != 0){
            countNumber.put('Odd',oddCount++);
        }
        else{
            countNumber.put('Even',evenCount++);
        }
    }
}
Create a map populate it with two records Odd and Even. Run a loop from 1-50, if you find a even number increase the count for even named record in map or else increase count of odd named record. Odd and even are keys, counts are values. Example map syntax: Map<String,integer> CountNumber = new map<String,Inetger>({'Even':4},{'Odd':3});

my code is this

public class NumberTest {
    integer oddCount = 0;
    integer evenCount = 0;
    
    Map<string,integer> countNumber = new Map<string,integer>();
    
    for(int i=1;i<=50;i++)
    {
        if(a[i] % 2 != 0){
            countNumber.put('Odd',oddCount++);
        }
        else{
            countNumber.put('Even',evenCount++);
        }
    }
}
Create a map populate it with two records Odd and Even. Run a loop from 1-50, if you find a even number increase the count for even named record in map or else increase count of odd named record. Odd and even are keys, counts are values. Example map syntax: Map<String,integer> CountNumber = new map<String,Inetger>({'Even':4},{'Odd':3});
want apex class code for above program:
Create a map populate it with two records Odd and Even. Run a loop from 1-50, if you find a even number increase the count for even named record in map or else increase count of odd named record. Odd and even are keys, counts are values.
Create a map populate it with two records Odd and Even. Run a loop from 1-50, if you find a even number increase the count for even named record in map or else increase count of odd named record. Odd and even are keys, counts are values. Example map syntax: Map<String,integer> CountNumber = new map<String,Inetger>({'Even':4},{'Odd':3});

my code is this

public class NumberTest {
    integer oddCount = 0;
    integer evenCount = 0;
    
    Map<string,integer> countNumber = new Map<string,integer>();
    
    for(int i=1;i<=50;i++)
    {
        if(a[i] % 2 != 0){
            countNumber.put('Odd',oddCount++);
        }
        else{
            countNumber.put('Even',evenCount++);
        }
    }
}