• RChintalapati
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

So I cannot seem to figure this one out. I do not use maps all that often and I am having a hard time determining how to update a value from it.

 

I am trying to update the inventory by subtracting the value from the map. Pleas see the code below:

trigger PO_Request_Update_Inv_Transit on PO_Request__c (after update) {

	PO_Request__c[] porequest;
	
	Set<Id> poSet = new Set<Id>();
	Set<Id> podetailSet = new Set<Id>();
	Set<Id> inventorySet = new Set<Id>();
	Map<String, Decimal> popartMap = new Map<String, Decimal>();
	List<Inventory__c> inventoryList = new List<Inventory__c>();
	List<PO_Request_Detail__c> porequestdetailList = new List<PO_Request_Detail__c>();
	
	for(PO_Request__c po:porequest)
	{
		poSet.add(po.Id);
		Decimal invQty = 0;
		
		If(po.PO_Req_Status__c == 'Approved')
		{
			porequestdetailList = [Select Id, PO_Request__c, Part_Num__c, Qty__c from PO_Request_Detail__c where PO_Request__c IN : poSet];
			
			for(PO_Request_Detail__c prd:porequestdetailList)
			{
				popartMap.put(prd.Part_Num__r.Id, prd.Qty__c);
				podetailSet.add(prd.Part_Num__c);
			}
			
			inventoryList = [Select Part_Num__r.Id, Qty__c from Inventory__c where Part_Num__c IN :podetailSet];
			
			for(Integer i = 0; i < inventoryList.size(); i++)
			{
				if(popartMap.containsKey(inventoryList[i].Part_Num__r.Id))
				{
					inventoryList[i].Qty__c = inventoryList[i].Qty__c - 
				}
				update inventoryList;
			}
		}
	}
}

 My main problem is how to get the mapped value and use it in my calculation to update.

 

inventoryList[i].Qty__c = inventoryList[i].Qty__c - ???

 

Thank you for your help.

All,

 

I am using an enhancedlist for a single visualforce page. However with Enhanced list it shows the inline editing (the pencil icon next to each item in a list) even when I set Customizable = false on the apex:enhancedList tag. However I don't want to globally disable inline editing via user interface settings. Is it possible to disable inline editing via code for a single visualforce page/ object.

 

On a different question, is it possible to display enhancedlist with a dynamic subset of records from an Object. I created a visualforce page with a custom controller for an object. The visualforce page has inputfields with which I filter the records on the Object. However I couldn't populate the enhanced list with these subset of records dynamically queried. I want to use enhanced list since it provides features like sorting, pagination etc. 

 

As a work around, this is what I am doing.  I created another object which maps with the fields on the original object. When the user queries/filters the original object, all the filtered records are copied to the new object. The new object is shown in the enhanced list. When I exit the page, I empty the new object. The issue with the work around is when two users are working on the visualpage. When one user is accessing the page and if a second user closes the page, the records are deleted and the first user has no access to the records any more.

 

Thanks all

 

So I cannot seem to figure this one out. I do not use maps all that often and I am having a hard time determining how to update a value from it.

 

I am trying to update the inventory by subtracting the value from the map. Pleas see the code below:

trigger PO_Request_Update_Inv_Transit on PO_Request__c (after update) {

	PO_Request__c[] porequest;
	
	Set<Id> poSet = new Set<Id>();
	Set<Id> podetailSet = new Set<Id>();
	Set<Id> inventorySet = new Set<Id>();
	Map<String, Decimal> popartMap = new Map<String, Decimal>();
	List<Inventory__c> inventoryList = new List<Inventory__c>();
	List<PO_Request_Detail__c> porequestdetailList = new List<PO_Request_Detail__c>();
	
	for(PO_Request__c po:porequest)
	{
		poSet.add(po.Id);
		Decimal invQty = 0;
		
		If(po.PO_Req_Status__c == 'Approved')
		{
			porequestdetailList = [Select Id, PO_Request__c, Part_Num__c, Qty__c from PO_Request_Detail__c where PO_Request__c IN : poSet];
			
			for(PO_Request_Detail__c prd:porequestdetailList)
			{
				popartMap.put(prd.Part_Num__r.Id, prd.Qty__c);
				podetailSet.add(prd.Part_Num__c);
			}
			
			inventoryList = [Select Part_Num__r.Id, Qty__c from Inventory__c where Part_Num__c IN :podetailSet];
			
			for(Integer i = 0; i < inventoryList.size(); i++)
			{
				if(popartMap.containsKey(inventoryList[i].Part_Num__r.Id))
				{
					inventoryList[i].Qty__c = inventoryList[i].Qty__c - 
				}
				update inventoryList;
			}
		}
	}
}

 My main problem is how to get the mapped value and use it in my calculation to update.

 

inventoryList[i].Qty__c = inventoryList[i].Qty__c - ???

 

Thank you for your help.

Hi All

 

I wish to enable INTELLISENSE feature in my VF Input Textbox, so that as soon as i start entering something, it shows a dropdown of items listing the most viable choices.

 

Kindly help!!!

 

Thanx in Advance

Shiv