You need to sign in to do that
Don't have an account?
sudhirn@merunetworks.com
Compare Set<Integer> compatible type
Hi
I am getting below error when trying to compare value with a integer please suggest me how to fix this issue and make the change.
Line: 126, Column: 6
Comparison arguments must be compatible types: Set<Integer>, Integer
Thanks
Sudhir
I am getting below error when trying to compare value with a integer please suggest me how to fix this issue and make the change.
Line: 126, Column: 6
Comparison arguments must be compatible types: Set<Integer>, Integer
Decimal LineMaxDiscount; Decimal LineMaxACV; Decimal SubLineMaxDiscount; Decimal SubLineMaxACV; Decimal SerLineMaxDiscount; Decimal SerLineMaxACV; Map<ID, Quote> ParentQuote = new Map<ID, Quote>(); String SALREPID; String MRGID; String SALID; String CFOID; String Level; Set<Integer> GSublevel1Count = new Set<Integer>(); Set<Integer> GSublevel2Count = new Set<Integer>(); Set<Integer> GSublevel3Count = new Set<Integer>(); Set<Integer> GSublevel4Count = new Set<Integer>(); Set<Integer> GSerlevel1Count = new Set<Integer>(); Set<Integer> GSerlevel2Count = new Set<Integer>(); Set<Integer> GSerlevel3Count = new Set<Integer>(); List<Id> listIds = new List<Id>(); //Set<Id> listIds = new Set<Id>(); List<Quote> QuotetList = new List<Quote>(); for (QuoteLineItem childquoteline : [SELECT id,QuoteId,Discount,Discount_Percent__c from QuoteLineItem where quoteid = '0Q0180000008isQ']) { listIds.add(childquoteline.QuoteId); } ParentQuote = new Map<Id, Quote>([SELECT id,Level_1__c,Level_2__c,Level_3__c,Level_4__c FROM Quote WHERE ID IN :listIds]); /* Subscription Discount and ACV */ List<AggregateResult> MaxSubscription = [select max(Discount_Percent__c) SubQuoteLineMaxDiscount,SUM(UnitPrice) SubQuoteLineMaxACV from QuoteLineItem where quoteid in :listIds and Subscription_Terms__c <> NULL ]; for (AggregateResult SubQuoteMaxDiscount : MaxSubscription) { SubLineMaxDiscount = (Decimal)SubQuoteMaxDiscount.get('SubQuoteLineMaxDiscount'); SubLineMaxACV = (Decimal)SubQuoteMaxDiscount.get('SubQuoteLineMaxACV'); } system.debug('Subscription Line Discount :' + SubLineMaxDiscount); system.debug('Subscription Line ACV :' + SubLineMaxACV); /* Service Discount and ACV */ List<AggregateResult> MaxService = [select max(Discount_Percent__c) SerQuoteLineMaxDiscount,SUM(UnitPrice) SerQuoteLineMaxACV from QuoteLineItem where quoteid in :listIds and Custom_Product_Name__c like 'CBSVC%']; for (AggregateResult SerQuoteMaxDiscount : MaxService) { SerLineMaxDiscount = (Decimal)SerQuoteMaxDiscount.get('SerQuoteLineMaxDiscount'); SerLineMaxACV = (Decimal)SerQuoteMaxDiscount.get('SerQuoteLineMaxACV'); } system.debug('Service Line Discount :' + SerLineMaxDiscount); system.debug('Service Line ACV :' + SerLineMaxACV); List<AggregateResult> GetLineDiscount = [select max(Discount_Percent__c) QuoteLineMaxDiscount,SUM(UnitPrice) QuoteLineMaxACV from QuoteLineItem where quoteid in :listIds]; for (AggregateResult QuoteMaxDiscount : GetLineDiscount) { LineMaxDiscount = (Decimal)QuoteMaxDiscount.get('QuoteLineMaxDiscount'); LineMaxACV = (Decimal)QuoteMaxDiscount.get('QuoteLineMaxACV'); } Quote Qot = [select id,OpportunityID from quote where id in :listIds]; Opportunity Opp = [select Subscription_Term__c,ownerid from opportunity where id = :Qot.OpportunityId]; system.debug('Subscription Term :' + Opp.Subscription_Term__c); User Usr = [select managerid from user where id = :opp.ownerid]; /* Subscription Query to get level 1..4 values */ if ( Opp.Subscription_Term__c != null && SubLineMaxACV != null && SubLineMaxDiscount != null) { GSublevel1Count = ApprovalUtils.SubLevel1(new Set<Decimal>{Opp.Subscription_Term__c},new Set<Decimal>{SubLineMaxACV},new Set<Decimal>{SubLineMaxDiscount}); system.debug('Subscription Level1 :' + GSublevel1Count); GSublevel2Count = ApprovalUtils.SubLevel2(new Set<Decimal>{Opp.Subscription_Term__c},new Set<Decimal>{SubLineMaxACV},new Set<Decimal>{SubLineMaxDiscount}); system.debug('Subscription Level2 :' + GSublevel2Count); GSublevel3Count = ApprovalUtils.SubLevel3(new Set<Decimal>{Opp.Subscription_Term__c},new Set<Decimal>{SubLineMaxACV},new Set<Decimal>{SubLineMaxDiscount}); system.debug('Subscription Level3 :' + GSublevel3Count); GSublevel4Count = ApprovalUtils.SubLevel4(new Set<Decimal>{Opp.Subscription_Term__c},new Set<Decimal>{SubLineMaxACV},new Set<Decimal>{SubLineMaxDiscount}); system.debug('Subscription Level4 :' + GSublevel4Count); } /* Service Query to get level 1..4 values */ if (SerLineMaxACV != null && SerLineMaxDiscount != null) { GSerlevel1Count = ApprovalUtils.SerLevel1(new Set<Decimal>{SerLineMaxACV},new Set<Decimal>{SerLineMaxDiscount}); system.debug('Service Level1 :' + GSerlevel1Count); GSerlevel2Count = ApprovalUtils.SerLevel2(new Set<Decimal>{SerLineMaxACV},new Set<Decimal>{SerLineMaxDiscount}); system.debug('Service Level2 :' + GSerlevel2Count); GSerlevel3Count = ApprovalUtils.SerLevel3(new Set<Decimal>{SerLineMaxACV},new Set<Decimal>{SerLineMaxDiscount}); system.debug('Service Level3 :' + GSerlevel3Count); } If( GSublevel1Count != 0 || GSerlevel1Count != 0 ) { SALREPID = Opp.OwnerId; MRGID = null; SALID = null; CFOID = null; Level = '1'; } else If (GSublevel2Count != 0 || GSerlevel2Count != 0) { SALREPID = NULL; MRGID = Usr.managerid; SALID = null; CFOID = null; Level = '2'; } else If ( GSublevel3Count != 0 || GSerlevel3Count != 0 ) { SALREPID = NULL; MRGID = Usr.managerid; SALID = '00580000007jaoA'; CFOID = null; Level = '3'; } else If ( GSublevel4Count != 0 ) { SALREPID = NULL; MRGID = Usr.managerid; SALID = '00580000007jaoA'; CFOID = '00580000006HV0w'; Level = '4'; } system.debug('Sales Rep' + SALREPID); system.debug('Manager ' + MRGID); system.debug('Sales Ops' + SALID); system.debug('CEO CFO' + CFOID);
Thanks
Sudhir
You cannot compare an integer with a set of integers, Example: [1,2,3,4,5] != 0. If you are checking to see if the set is empty, then you can say "if( GSublevel1Count.size() != 0 )"
If you are trying to sum up the integers in GSublevel1Count, then you would need to loop through the set and store the sum into a different variable. Like so:
Hope that helps
All Answers
You cannot compare an integer with a set of integers, Example: [1,2,3,4,5] != 0. If you are checking to see if the set is empty, then you can say "if( GSublevel1Count.size() != 0 )"
If you are trying to sum up the integers in GSublevel1Count, then you would need to loop through the set and store the sum into a different variable. Like so:
Hope that helps