• Jay Choi 38
  • NEWBIE
  • 20 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 0
    Replies
Hi I want to call method in Controller1 and use it on VF page which is linked with controller2 

Controller 1 Code:
public class AccountMultipleSearch {

    public Account acc{get;set;}
public List<Account> accountList {get;set;}
// create a list of strings to hold the conditions
List<string> conditions = new List<string>();
private integer totalRecs = 0;
private integer OffsetSize = 0;
private integer LimitSize= 10;

public AccountMultipleSearch(){
system.debug('==>AccountMultipleSearch  is calling==>');
 acc = new Account();
 //accountList  = new List<Account>();
}

public void searchAcc(){
totalRecs = 0;
OffsetSize = 0;
if(accountList !=null && accountList.size()>0){
 accountList=null;
}
searchAccounts ();
conditions.clear();
}

Controller2 Code :
public class c9 {
    
    public AccountMultipleSearch t{get;set;}
    
    public c9(){
        
        AccountMultipleSearch t = new AccountMultipleSearch();
        t.FirstPage();

    }
    
}

VF page :
<apex:page controller="c9" action="{!t.searchAcc}" >
<script type="text/javascript">
    window.onload=function() {
    // document.getElementById("{!$Component.thePb.thepbs.accName}").focus();
    }   
</script>
 <apex:form >
  <apex:pageBlock id="thePb" title="Venue Details To Search">
   <apex:pageblockSection id="thepbs">
   
     <apex:inputField value="{!t.acc.Name}" required="false" id="accName"/>
     <apex:inputfield value="{!t.acc.accountNumber}"/>
   </apex:pageblockSection>
   <apex:pageblockButtons location="Top">
      <apex:commandButton value="Search" action="{!t.searchAcc}" />
     </apex:pageblockButtons>  
  </apex:pageBlock>
</apex:form>
</apex:page>

When I previewed this VF page it returns me 

Unknown method 'c9.searchAcc()'
Error is in expression '{!t.searchAcc}' in component <apex:page> in page v9

Thank you for your help!!
 
Hi, I try to show map object in table and this is my current result.User-added image

But I want to make a table like this, 
User-added imageHow can I do it? 
I am new to working with frontend coding so any advice will be really helpful. 
Here is my apex code
public class InventoryReport{
        
        public Map<String, List<AggregateResult>> allProduct { get; set; }
        
        public InventoryReport(String batchname) {
        allProduct = new Map<String, List<AggregateResult>>();
        AggregateResult[] results = [
            SELECT  VenueBatch__r.Name vnme, VenueBatch__r.BillingStreet vbs, VenueBatch__r.BillingCity vbc, VenueBatch__r.BillingState vbse, VenueBatch__r.BillingPostalCode vbpc,
            CampaignBatch__r.Name cnme,Venue_Kiosk__r.Name vkn, Venue_Kiosk__r.Location_in_Venue__c vklv
 
        FROM Batch__c 
        WHERE Name =:batchname
        GROUP BY VenueBatch__r.Name, VenueBatch__r.BillingStreet, VenueBatch__r.BillingCity, VenueBatch__r.BillingState, VenueBatch__r.BillingPostalCode,
            CampaignBatch__r.Name,Venue_Kiosk__r.Name, Venue_Kiosk__r.Location_in_Venue__c];
        for(AggregateResult result: results) {
            System.Debug(result);
        String center = (String)result.get('vnme')+ ': ' + (String)result.get('vbs') +', '+  (String)result.get('vbc') +', '+ (String)result.get('vbse') +', '+ (String)result.get('vbpc');
        if(!allProduct.containsKey(center)) {
          allProduct.put(center, new AggregateResult[0]);
            System.Debug(allProduct);
            }
            allProduct.get(center).add(result);
          }
        }
    }
 Public Map<String, List<AggregateResult>> getWork_Order(){
        InventoryReport report = new InventoryReport(BatName);
        return report.allProduct;
        //List<Batch__c> results = [SELECT Batch__c.Name, VenueBatch__r.Name, VenueBatch__r.BillingStreet, VenueBatch__r.BillingCity, VenueBatch__r.BillingState, VenueBatch__r.BillingPostalCode, AdvertiserBatch__r.Name, BatchArt__r.Name  FROM Batch__c WHERE Name =: BatName];
        //return results;
       
    }

And here is my Visualforce Code 

<apex:form >
        <style>
       
       
            </style>
      
        <apex:pageBlock title="Work Order" id="Work_Order">
            
       <apex:repeat value="{!Work_Order}" var="key">
            
            <tr>{!key}
                <th align = "center" style ="height:50px; width:200px">{!key}</th>
                
            <th id = "Campaign" style="height:35px; width:100px"> Campaign</th>
            <th id = "Kiosk" style="height:35px; width:100px"> Kiosk</th>
                <th id = "Kiosk Location" style="height:35px; width:100px"> Kiosk Location</th>
            </tr>
            
            <apex:repeat value="{!Work_Order[key]}" var="row">
                
                   <td headers = "Campaign" style="height:50px; width:50px" >{!row['cnme']}</td>
                <td headers = "Kiosk" style="height:50px; width:50px" >{!row['vkn']}</td>
                <td headers = "Kiosk Location" style="height:50px; width:50px" >{!row['vklv']}</td>
                <td class = "break"/>
            </apex:repeat>
            </apex:repeat>
            
        </apex:pageBlock>
            
       
        
            <apex:pageBlock title="ArtWork" id="ArtWork">
        
        
            
        </apex:pageBlock>
       
        
   
    </apex:form>
Hi, I try to use image which is stored in Amazon Aws. 
So this link is like http://~~/s3.amazonaws.com/~~.jpg

I try to show this image on visualforce page with this link. 
How can I do it? 
Thank you!

Hi all, 
I want to make triggers that automatically move certain rows from table A to table B once in a month until the end of expiration date. 
I thinked about using a time trigger, but it doesn't work as I expected. 
Is there a way to make this possible? 
Any hints or advice is really appreciated. 
Thank you!
Hi, I have error "Invalid field nme for SObject AggregateResult"
From VisualForce Page 

Here is my apex controller
public class BatchListController {
    public Id venue {get; set;}
    
    Public List<Batch__c> Batches = new List<Batch__c>();   
    Public AggregateResult[] agr {get{
        return [SELECT Name nme, count(Job__r.Id) cntid, count(Job__r.Name) cntnme, max(BatchDate__c) cntdt, count(VenueBatch__r.Name) cntvn FROM Batch__c GROUP BY Name];
        
        
    } set;}
    
    Public BatchListController() {
        system.debug('==>JobListController  is calling==>');
        Batches = [SELECT Name,Job__r.Id, Job__r.Name, BatchDate__c, VenueBatch__r.Name FROM Batch__c];
        
    }
    public List<Batch__c>getBatches(){
        
        return Batches;
    }
    public List<Batch__c>setBatches(List<Batch__c>temp){
        
        Batches = temp;
        return Batches;
    }
}

And here is my visualforce page 

<apex:page controller = "BatchListController">
    
    <apex:form>
    
    <apex:PageBlock title="Batch List" id="Jobs_List" >
        
        <apex:pageBlockTable value = "{!agr}" var = "a">
             
            <apex:column style="width:350px" headerValue="Batch" value="{!a['nme']}"/>
            <apex:column style="width:350px" headerValue="#of Jobs " value="{!a['cntid']}"/>
            <apex:column style="width:350px" headerValue = "# of Venue " value="{!a['cntvn']}"/>
            <apex:column style="width:350px" headerValue = "Batch Date" value="{!a['cntdt']}"/>
        </apex:pageBlockTable>
        
        </apex:PageBlock>
        
        <apex:pageBlock title = "Work Order" id = "Work_Order">
        
        
            
        </apex:pageBlock>
    
    </apex:form>
</apex:page>

I am dealing with this for an hour but I don't know where I am wrong. 
Thank you!!
Hi I am using Standard Controller with extension on it. 
But as soon as I add extension I got this error. 
"
Unknown property 'Job__cStandardController.PageNumber'
"
Here is my Apex Code

public class JobListController {
    public Id venue {get; set;}
    private final Job__c jobc; 
    
    public JobListController(ApexPages.StandardController stdController){
        
        this.jobc = (Job__c)stdController.getRecord();
    }
}

Here is my VisualForce Code 

<apex:page standardController="Job__c" extensions="JobListController">
    <apex:form >
        <apex:pageBlock title="Contacts List" id="Jobs_List" >
           
            
        <apex:pageBlockTable value="{! jobs}" var="jb">
            <apex:column style="width:350px" value="{!jb.JobId__c}"/>
            <apex:column style="width:350px" headerValue="Confirmation">
                <apex:inputField value="{!jb.Confirm__c}"/>
            </apex:column>
            <apex:column style="width:350px" headerValue="JobType">
                <apex:inputField value="{!jb.JobType__c}"/>
            </apex:column>
            <apex:column style="width:350px" headerValue="ServiceDate">
                <apex:inputField value="{!jb.ServiceDate__c}"/>
            </apex:column>
            <apex:column style="width:350px" headerValue="ServiceRep">
                <apex:inputField value="{!jb.ServiceRep__c}"/>
            </apex:column>
            <apex:column style="width:250px" headerValue="Campaign Name" value="{!jb.Opportunity__r.Name}"/>
            <apex:column style="width:250px" headerValue="Case Name" value="{!jb.Case__r.Reason}"/>
            <apex:column style="width:350px" headerValue="Venue">
                <apex:commandLink reRender="kiosk">
                            {!jb.Venue__r.Name}
                    <apex:param name="inputparam" value="{!jb.Venue__r.Id}" assignTo="{!venue}"/>
                </apex:commandLink>
                
                </apex:column>
            <apex:column style="width:350px" value="{!jb.ArtID__r.Name}"/>
        </apex:pageBlockTable>
            <!-- Pagination -->
        <table style="width: 100%"><tr>
            <td>
            <!-- Page X of Y -->
                Page: <apex:outputText
                value=" {!PageNumber} of {! CEILING(ResultSize / PageSize) }"/>
            </td>
            <td align="center">
            <!-- Previous page -->
            <!-- active -->
                <apex:commandLink action="{! Previous }" value="« Previous" rendered="{! HasPrevious }"/>
            <!-- inactive (no earlier pages) -->
                <apex:outputText style="color: #ccc;" value="« Previous" rendered="{! NOT(HasPrevious) }"/>
                &nbsp;&nbsp;
        <!-- Next page -->
        <!-- active -->
                <apex:commandLink action="{! Next }" value="Next »" rendered="{! HasNext }"/>
        <!-- inactive (no more pages) -->
                <apex:outputText style="color: #ccc;" value="Next »" rendered="{! NOT(HasNext) }"/>
                </td>
                <td align="right">
                    <!-- Records per page -->
                    Records per page:
            <apex:selectList value="{! PageSize }" size="1">
                <apex:selectOption itemValue="5" itemLabel="5"/>
                <apex:selectOption itemValue="20" itemLabel="20"/>
                <apex:actionSupport event="onchange" reRender="contacts_list"/>
            </apex:selectList>
    </td>
</tr></table>

        <apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" /> 
 
        </apex:pageBlock>

        
          <apex:pageBlock >
                <apex:pageBlockTable Id="kiosk" value="{! Venue_Kiosks}" var="vk">
                    <apex:column value="{!vk.Name}"/>
                    <apex:column value="{!vk.Id}"/>
                 </apex:pageBlockTable>
            </apex:pageBlock>
        
        <apex:pageBlock >
        <apex:outputPanel id="kiosks"> 
     <apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false" title="false"/>
 </apex:outputPanel> 
            </apex:pageBlock>
        </apex:form>
</apex:page>

I am dealing with error for 3 hours...but Can't figure out the reason. 
I really appreciate any help! Thank you