You need to sign in to do that
Don't have an account?
rajesh k 10
How can i check map Condition?
Hi,
Using vf page I calculated
In controller i constructed map like below
I was getting some times Map Key not Exist(It show in like 01tD000000108Mw(ProductId) with visualforce page culcuation).How can i chaeck Map Condition here
help me...
Using vf page I calculated
<apex:column headerValue="Total"> <apex:outputtext value="$ {!IF(Inpitem.includedProduct.Quantity__c > 0 , Inpitem.includedProduct.Quantity__c * ProductidToPricebookEntry[Inpitem.includedProduct.Product__c], 0)}"> <apex:variable var="grandTotal" value="{!grandTotal + (Inpitem.includedProduct.Quantity__c * ProductidToPricebookEntry[Inpitem.includedProduct.Product__c])}" /> </apex:outputtext> </apex:column>
In controller i constructed map like below
for (PricebookEntry pricBkEntry: [SELECT Product2Id, Pricebook2Id, UnitPrice FROM PriceBookEntry WHERE Product2Id IN: productids AND Pricebook2Id = : pricebookid AND CurrencyIsoCode = 'USD']) { Decimal Listprice = pricBkEntry.UnitPrice; ProductidToPricebookEntry.put(pricBkEntry.Product2Id, Listprice); }
I was getting some times Map Key not Exist(It show in like 01tD000000108Mw(ProductId) with visualforce page culcuation).How can i chaeck Map Condition here
help me...
I am afraid there is no direct way to check if the map has the key, since we cannot use containsKey() method inside VF page. However, you can use something like this:
Controller:
VF page:
There are various other ways discussed here (http://salesforce.stackexchange.com/questions/15748/can-we-check-if-a-key-exists-in-a-map-in-vf-page).
--
Abhi
If my answer helps to solve the issue/problem/doubt, please mark it as Best Answer; so that people who are stuck in the similar issue get benefitted.