new to apex and visualforce. I am trying to create a visualforce page that displays selected products and their locations for an order. Currently I am able to display the products selected for the order, however I can not figure out how to filter my query down to display only the product locations specific to the current order. I added the Shipment__c query to help look for products that are in shipments however I am getting the following error:
Error: Compile Error: Invalid bind expression type of Shipment__c for Id field of SObject Product2 at line 8 column 17
Any help would be appreciated.
My class is as follows:
public with sharing class ProductMovements {
Shipment__c[] sp = [Select (Select Project_Task__r.GMBLASERP__Product__r.Id From Shipment_Lines__r) From Shipment__c ];
Product2[] pp = [SELECT Id FROM Product2 WHERE Id IN :sp];
public AggregateResult[] gim {
get {
return [SELECT GMBLASERP__Product__r.name name, GMBLASERP__Location__r.name location, SUM(GMBLASERP__Quantity__c) sum
FROM GMBLASERP__Inventory_Movement_Cube__c
WHERE GMBLASERP__Product__c IN :pp
GROUP BY GMBLASERP__Product__r.name, GMBLASERP__Location__r.name];
}
}
}
Database.query
. You do none of that here, using only static queries. As such, I have removed the[dynamic-soql]
tag.