You need to sign in to do that
Don't have an account?
Girbson Bijou 7
ist has more than 1 row for assignment to SObject error
Help please, I test the SOQL query in developer Console, and work as expected But, i get error message in the VF
My Controller is:
public class InventoryReport {
public List<Articles_Containers__c> allproduct{get;set;}
public InventoryReport() {
AggregateResult allproduct = [
SELECT Product_Hiden_Name__c, UM__c ,SUM(On_Hand__c)onHand, SUM(Pending__c)pending, SUM(Available__c)avail
FROM Articles_Containers__c
GROUP BY Product_Hiden_Name__c , UM__c
HAVING SUM(On_Hand__c)>0
ORDER BY Product_Hiden_Name__c, UM__c
limit 1000];
}
}
VF Page is:
<apex:page controller="InventoryReport" showHeader="true" RenderAs="PDF">
<div class="table">
<div class="tableHeader">
<th>Item</th>
<th>Unit Of Measure </th>
<th>On Hand </th>
<th>Pendig </th>
<th>Available </th>
</div>
<apex:repeat value="{!allproduct}" var="a"> <!-- <div class="tablebody"> -->
<tr>
<td>{!a.Product_Hiden_Name__c }</td>
<td>{!a.UM__c}</td>
<td>{!a.On_Hand__c}</td>
<td>{!a.Pending__c}</td>
<td>{!a.Available__c}</td>
</tr>
</apex:repeat> </div>
</apex:page>
My Controller is:
public class InventoryReport {
public List<Articles_Containers__c> allproduct{get;set;}
public InventoryReport() {
AggregateResult allproduct = [
SELECT Product_Hiden_Name__c, UM__c ,SUM(On_Hand__c)onHand, SUM(Pending__c)pending, SUM(Available__c)avail
FROM Articles_Containers__c
GROUP BY Product_Hiden_Name__c , UM__c
HAVING SUM(On_Hand__c)>0
ORDER BY Product_Hiden_Name__c, UM__c
limit 1000];
}
}
VF Page is:
<apex:page controller="InventoryReport" showHeader="true" RenderAs="PDF">
<div class="table">
<div class="tableHeader">
<th>Item</th>
<th>Unit Of Measure </th>
<th>On Hand </th>
<th>Pendig </th>
<th>Available </th>
</div>
<apex:repeat value="{!allproduct}" var="a"> <!-- <div class="tablebody"> -->
<tr>
<td>{!a.Product_Hiden_Name__c }</td>
<td>{!a.UM__c}</td>
<td>{!a.On_Hand__c}</td>
<td>{!a.Pending__c}</td>
<td>{!a.Available__c}</td>
</tr>
</apex:repeat> </div>
</apex:page>
<apex:page controller="InventoryReport" renderAs="pdf" showHeader="false" sidebar="false" standardStylesheets="false" applyBodyTag="false" >
<div class="table">
<div class="tableHeader">
<th>ITEM</th>
<th>UNIT OF MEASURE </th>
<th>ON HAND </th>
<th>PENDING </th>
<th>AVAILABLE </th>
</div>
<apex:repeat value="{!allproduct}" var="a">
<!-- <div class="tablebody"> -->
<tr>
<td>{!a['Product_Hiden_Name__c'] }</td>
<td>{!a['UM__c']}</td>
<td>{!a['OnHand']}</td>
<td>{!a['Pending']}</td>
<td>{!a['avail']}</td>
</tr>
</apex:repeat>
</div>
</apex:page>
Controller IS:
public class InventoryReport {
public List<AggregateResult> allproduct{get;set;}
public InventoryReport() {
allproduct = [
SELECT Product_Hiden_Name__c, UM__c ,SUM(On_Hand__c)onHand, SUM(Pending__c)pending, SUM(Available__c)avail
FROM Articles_Containers__c
WHERE IsOpened__c = 1
GROUP BY Product_Hiden_Name__c , UM__c
HAVING SUM(On_Hand__c) >0
ORDER BY Product_Hiden_Name__c, UM__c limit 1000];
}
}