• bpl3792
  • NEWBIE
  • 47 Points
  • Member since 2011

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

Hi,

 

I have created a input box and a link. When I click on the link, an alert will show the value of the input box. But this is not happening as of now, Please suggest the code changes. Thanks!

 

<apex:page id="pa">
 <apex:includeScript value="{!$Resource.jQuery}"/>
 <script type="text/javascript">
         var j$ = jQuery.noConflict();
         
         j$(document).ready(function(){
             j$("a").click(function(){
            var xyz = j$("#pa:f1:userInput").val();
            //var xyz = document.getElementById('{!$Component.pa.f1.userInput}').value;
             alert(xyz);
             });
        });         
  </script>

  <a herf="#" id="clickHere">click here</a>
  <apex:form id="f1">
      enter something <apex:inputText id="userInput"/>  
  </apex:form>
</apex:page>

 Thanks

Sam

 

 

I'm trying to pump a string into a visualforce page that creates a CSV. The problem I'm having is when I return the page reference to the JS Remoting event, no redirect actually happens...The console just shows the page I want to redirect to.
Here's my code from the controller...

    @RemoteAction
    global static PageReference HTMLDump(string html) {
        //getCSV(html);
        CSVContent=html;
        PageReference pageRef=page.CSV_ExportPage;
        pageRef.setRedirect(true);
        system.debug(CSVContent);
        return pageRef;
    }

 

            Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.CSV_ExportPage.HTMLDump}',
                   CSVRows,
                   function(result, event)
                   { 
                            console.log(result);     
                   });

 After doing a system.debug in the controller I was able to verify that the string is being passed in fine...it's just the redirect that isn't working. I have a feeling it has something to do with the way I'm using the JS remoting but I'm not sure how else to go about it.


 

Any help in the right direction would be greatly appreciated!

The query I wrote is this...

Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c,
(Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c
from Qualification__c where Provider__c='00540000000x5ha' and RecordTypeId='01230000000DHlx'),
(Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c
from Qualification__c where Provider__c='00540000000x5ha' and RecordTypeId='01230000000DHmR')

 I'm trying to get it to act similarly to this query in SQL....

SELECT a.name,a.Region__c ,rt.Name, 
 qd.Type__c DEAType ,qd.State__c  ,qd.License_Certificate_Number__c DEANumber ,
c.Name,c.GlobalProviderID__c
, qs.Type__c StateLincType,qs.License_Certificate_Number__c StateLinc,qs.State__c ,
qb.Type__c StateLincType,qb.License_Certificate_Number__c StateLinc,qb.State__c 
FROM dbo.Account a 
      INNER JOIN RecordType rt ON a.RecordTypeId =rt.Id 
      INNER JOIN dbo.Provider_Facility_Associations__c pfa on pfa.Hospital__c  =a.id
      INNER JOIN dbo.Contact c on c.id =pfa.Provider__c
      LEFT OUTER JOIN dbo.Qualification__c qD ON qd.Provider__c =c.id AND qd.RecordTypeId ='01230000000DHlxAAG' AND qd.Type__c ='DEA'
      LEFT OUTER JOIN dbo.Qualification__c qS ON qs.Provider__c =c.id AND qs.RecordTypeId ='01230000000DHlxAAG' AND qs.Type__c ='State Medical' AND qs.State__c =a.Physical_State__c
      LEFT OUTER JOIN dbo.Qualification__c qB ON qb.Provider__c =c.id AND qb.RecordTypeId ='01230000000DHmRAAW' 

 
I'm trying to display multiple qualification records in the same row of their associated contact. Any help would be greatly appreciated.

The code looks fine to me which is why I'm confused with the G_SResult variable losing scope. It's declared globally above the ready function but that isn't visible in the screenshot. In the screenshot you will see 4 highlighted alert expressions. The one with the red dot is where it returns undefined. The other alerts return the right value.

Passing an id from jquery to the actionfunction so it can do a page redirect. I had it working but for some reason it's not passing an id anymore, just a null. When I do alert(id); in the function being called, the alert comes up with the requested id. For some reaosn the id seems to get lost when going from jQuery to the action function. Any idea why this might be happening?

        j$('#Edit_Asset').live('click', function(){
            callActionMethod();

        });
        function callActionMethod(){
 
            pgRedirect_EditAsset(id);
        }
          
    });
   
</script> 

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
</head>
<apex:form >
<apex:actionFunction name="pgRedirect_EditAsset" action="{!RedirectToEditAsset}" immediate="true">
    <apex:param name="IdParam" assignTo="{!AssetId}" value="" />
</apex:actionFunction>

 
Here's the apex

public String AssetId                               {get;set;} 
       public PageReference RedirectToEditAsset()
        {
            string url='/apex/AS_AssetEdit_m?id='+AssetId;
            PageReference pageRef = new PageReference(url);
           
           return pageRef;
            
        }

 

  • September 20, 2012
  • Like
  • 0

I have a jquery grid that created and filled with data after a search is complete. When you click on a row another div is created to display more information. Inside the div with more info is a button that should redirect you to another page while passing an id as an argument. The problem I'm having is when I try to use the onClick of the button for a page redirect it returns undefined. I was able to  j$('#Edit_Asset').live('click', function(){ to finally recognize the element and do the event...the only problem I have with this is when i use window.opener.location.href=document.domain+'/apex/AS_AssetEdit_m?id='+id; it doesn't go to the new page, it stays on the same page and reloads another instance of it. Anyone have any idea what else I could usei n jQuery to redirect the page?

Here's the code

<script>
    var j$ = jQuery.noConflict();
    var Results_Div=j$('#Results_Grid');
    var Results_Grid_Header=j$('#Results_Grid_Header');
    var QFilter;
    var SearchString;
    var PowersCombined;
    var oldResultElement;
    var id;
    var com;
    var res;
    j$(function() {    
       Results_Div=j$('#Results_Grid');
       QFilter=j$('#Query_Filter').val();
       SearchString=j$('#SearchBox').val();
       PowersCombined=QFilter+'°'+SearchString;
                       
           j$('#Search_Submit').click(function(){
                   
                  QFilter=j$('#Query_Filter').val();
                  SearchString=j$('#SearchBox').val();
                  PowersCombined=QFilter+'°'+SearchString;

                  Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AS_Viewer_m.getAssets}',
                  PowersCombined,
                  function(result, event)
                  { 
                      j$('#Results_Grid').children().remove();
                      id=result.id;
                      for(var b = 0; b < result.length; b++){
                          
                          j$('<div class="ui-grid-d" name="AssetGrid" id="AssetGrid'+result[b].Id+'" >'+
                              '<div class="ui-block-a"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Name+'</div></div>'+
                              '<div class="ui-block-b"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Model__r.Name+'</div></div>'+
                              '<div class="ui-block-c"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Serial_Number__c+'</div></div>'+
                              '<div class="ui-block-d"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].User+'</div></div>'+
                              '<div class="ui-block-d"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Acquisition_Date__c+'</div></div>'+
                              '<div id="AssetInfo'+result[b].Id+'" name="AssetInfo" style="width:1000px; margin:0 auto;"></div>'+
                            '</div>').appendTo(Results_Div);
                            
                      }
                            
                  },{escape: true});  
       
       });
       j$('#Results_Grid').on('click','div[name="AssetGrid"]', function(e) {
         j$('#DataDiv').empty().remove();

         if (oldResultElement!=null){
             j$(oldResultElement).children().remove();
            
         }

         var st=this.id;
         com='#AssetInfo'+st.substring(9);
         
         oldResultElement='#AssetInfo'+st.substring(9);

         Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AS_Viewer_m.getAsset}',
            st.substring(9),
            function(result, event)
            {
             
             id=result.Id;

             if(result.RecordType.DeveloperName=='Infrastructure_Hardware'){

               j$('<div id="DataDiv" style="width:1000px; margin:0 auto;" style="width:1000px; margin:0 auto;">'+
               '<div style="width:500px;float:left;" id="MoData_LeftDiv">'+
               '<b>Asset Name: </b>'+result.Name+'<br/>'+
               '<b>Serial Number: </b>'+result.Serial_Number__c+'<br/>'+
               '<b>Model: </b>'+result.Model__r.Name+'<br/>'+
               '<b>Host Name: </b>'+result.Host_Name__c+'<br/>'+
               '<b>IP Address: </b>'+result.IP_Address__c+'<br/>'+
               '<b>MAC Address: </b>'+result.Mac_Address__c+'<br/>'+
               '<b>Comments: </b>'+result.Comments__c+'<br/>'+
               '</div>'+
               '<div style="float:left;width:300px;padding:0px 0px 0px 80px; id="MoData_MidDiv"">'+
               '<b>Account/Hospital: </b>'+result.Account_Hospital__c+'<br/>'+
               '<b>Date Lost/Stolen: </b>'+result.Date_Lost_Stolen__c+'<br/>'+
               '<b>Acquisition Date: </b>'+result.Acquisition_Date__c+'<br/>'+
               '<b>Decommission Date: </b>'+result.Decommission_Date__c+'<br/>'+
               '<b>Allocation: </b>'+result.User__c+'<br/>'+
               '</div>'+ 
               '<div style="width:80px;float:left;" id="MoData_RightDiv">'+
                      '<input type="image" src="{!URLFOR($Resource.Coquette, 'PNG/64x64/edit.png')}"  href="#" id="Edit_Asset"/><br/>'+
                      '<input type="image" src="{!URLFOR($Resource.Coquette, 'PNG/64x64/trash_can.png')}"  href="#" id="Delete_Asset"/>'+
               '</div>'+
               '<br style="clear:both;"/>'+
               '</div>').insertbefore(com);
               
                                                  
              }
            },{escape: true});
                           
        });

        j$('#Edit_Asset').live('click', function(){
            {!$Page.AS_AssetEdit_m}?id={!'+id+'}
            window.opener.location.href=document.domain+'/apex/AS_AssetEdit_m?id='+id;
        });
        

          
    });
   
</script> 

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
</head>
<apex:form >
<div data-role="header"> 
    <h1>Find Asset</h1> 
</div> 

<div id="Search_Div" class="Element_LeftAlign">
<input type="text" id="SearchBox" style="width:300px;display:inline;"/>
<button type="button" style="vertical-align:bottom;display:inline;" id="Search_Submit">Search</button>
    <select size="1" id="Query_Filter">
        <option value="00">--Please select--</option>
        <option value="01">Serial Number</option>
        <option value="02">Name</option>
        <option value="03">Allocated To</option>
        <option value="04">In Inventory</option>
    </select>
    <!--Make this a button that expands out-->
</div>
<div id="Results_Grid_Header" data-theme="d" style="display:inline;position:fixed;top:170px;">
<div class="ui-grid-d">
<div class="ui-block-a ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Name</b></div></div>
<div class="ui-block-b ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Model</b></div></div>
<div class="ui-block-c ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Serial Number</b></div></div>
<div class="ui-block-d ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Allocated To</b></div></div>
<div class="ui-block-e ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Acquisition Date</b></div></div>
</div>
<div id="Results_Grid" class="" style="overflow:auto;height:350px;">

</div>
</div>




</apex:form>
</apex:page>

 

  • September 19, 2012
  • Like
  • 0

I've attached a vertical screen shot of some crazy stuff going on. Am I right to expect j$('[id$=Model_List]').children().remove(); to remove all items in a select list? For some reason the list is still holding on to the old selected value while clearing out the rest of the items. I'm using the <Apex:selectlist in the html block, just not in the jQuery.
VG930M should be V243H as seen in hte console log...
Hopefully the screenshot gives you a better idea of what I'm talking about...

 

Any assistance would be greatly appreciated!

Trying to add some jQuery to my tool belt but salesforce is showing me no love. I've followed this tutorial to the T and still having no luck. The code/walk through looks super basic and shouldn't be an issue for me but I've spent a good minute on trying to figure out whatsup to no avail. Any help in the right direction would be greatly appreciated!

<apex:page standardStylesheets="false">
<apex:form >

<apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-ui-1.8.21.custom.min.js')}"/>
<apex:includeScript value="{!URLFOR($Resource.jquery, 'js/jquery-1.7.2.min.js')}"/>
<apex:stylesheet value="{!URLFOR($Resource.jquery, 'css/custom-theme/jquery-ui-1.8.21.custom.css')}"/>


<script type="text/javascript">
    var j$ = jQuery.noConflict();
    
        j$(function() {
            j$( "#tabs" ).tabs(); 
        });
     j$("[id$=date]").datepicker();
     J$("[id$=date]").click(function(){ alert('asdf');}); 


    
     j$(document).ready(function(){
            j$("#ninjaLink").click(function() {
                alert("NINJA STAR TO FACE!!!!!");
            });
        });
</script>

<a id="ninjaLink" href="">NINJA ATTACK!</a>

 <apex:inputtext id="date" />
<div class="demo">

<div id="tabs">
    <ul>
        <li><a href="#tabs-1">Tab 1</a></li>
        <li><a href="#tabs-2">Tab 2</a></li>
        <li><a href="#tabs-3">Tab 3</a></li>
    </ul>
    <div id="tabs-1">
    
        <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
    </div>
    <div id="tabs-2">
        <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
    </div>
    <div id="tabs-3">
        <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
        <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
    </div>
</div>

</div><!-- End demo -->



<div class="demo-description" style="display: none; ">
<p>Click tabs to swap between content that is broken into logical sections.</p>
</div>
</apex:form>
</apex:page>

 

 

Here is the code I have written as of now and I'm trying to get my update working but it's telling me "DML requires SObject or SObject list type: Decimal". I'm not sure how I could resolve this error but any help would be greatly appreciated!

if(tnew.Reimbursement_Rate__c!=told.Reimbursement_Rate__c){
	if(tnew.SG_Charge_Price_Sheet__c!=told.SG_Charge_Price_Sheet__c){
		
			//map<ID,FCC_Code_Entry__c[]> code =new map<string,Map<ID,FCC_Code_Entry__c[]>>();
			map<String,double> code =new map<String,double>();
			for(Price_Sheet_Code_Entry__c PSC:[select Charge_Amount__c,Code_Master__r.name from Price_Sheet_Code_Entry__c where Code_Price_Sheet__c=:tnew.SG_Charge_Price_Sheet__c]){
				code.put(PSC.Code_Master__r.name,PSC.Charge_Amount__c);
			}
			
			for(FCC_Code_Entry__c codes:[select id,Reimbursement_Amount__c from FCC_Code_Entry__c  where Facility_Carrier_Contract__c =:tnew.Id]){
				double FCCCode=code.get(codes.Code_Master_Reference__r.name);
				double ReimAmt=(double.valueof(FCCCode)*double.valueof(tnew.Reimbursement_Rate__c));
				try {
				update codes.Reimbursement_Amount__c=ReimAmt; 
				} catch (DmlException e) {
					
				}
			}
	}

}

 

We want to be able to log an object for historical purposes but it's way too much data to do that through salesforce so I figured we could dump the data into a CSV file. I want to be able to dump the CSV file itself directly to the attachments object if that's possible. 

The way I'm currently generating the CSV file is by using the following in my visualforce page...

<apex:page standardController="Facility_Carrier_Contract__c" extensions="mc_FCCCodeHistory" id="page" standardStylesheets="false" showHeader="false" sidebar="false" contenttype="application/x-excel#export.csv">
{!exportData}</apex:page>

 

 

I'm trying to build a class that imports a .csv file. Everything works fine except for one field I need to import into. That field is a lookup for another object and I don't want to overwrite data in the object being looked up to...just the field making the lookup. ICCN.Code_Master_Reference__r = CM.id; is the culprit but I'm at a loss as to how I should do this. 

 

public with sharing class mc_CCNCodeImport {

    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    public string PSAmt {get;set;}
    public string PSReimAmt {get;set;}
    public Carrier_Contract_Negotiation__c CCN {get;set;}
    public String Delquery;
    public  List<CCN_Code_Entry__c> CCNCodestoupload {get;set;}
	public  List<Code_Master__c> CM {get;set;}
      
    String[] filelines = new String[]{};
   
    
   public mc_CCNCodeImport(ApexPages.StandardController controller){
    	this.CCN=(Carrier_Contract_Negotiation__c)controller.getRecord();
    }
   
 
    public Pagereference ReadFile()
    {
    	
    	Delquery='SELECT Code_Master_Reference__c, Pricesheet_Amount__c, Reimbursement_Amount__c FROM CCN_Code_Entry__c WHERE Carrier_Contract_Negotiation__c= \''+CCN.id+ '\'';
    	
    	CCN_Code_Entry__c[] doomedCodes=Database.query(Delquery);
    	
    	Database.Deleteresult[] DR_Dels=Database.delete(doomedCodes);
  
    	
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        CCNCodestoupload = new List<CCN_Code_Entry__c>();
		CM=new list<Code_Master__c>();
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
           	CCN_Code_Entry__c ICCN = new CCN_Code_Entry__c();

           	ICCN.Carrier_Contract_Negotiation__c=CCN.id;
           
           string query='SELECT id FROM Code_Master__c WHERE Name= \''+inputvalues[0]+ '\'';
           CM=Database.query(query);

           
           
           String PSReimAmt=String.valueOf(ICCN.Reimbursement_Amount__c);
       
             
           	ICCN.Code_Master_Reference__r = CM.id;
           	PSReimAmt=inputvalues[1];
            
            ICCN.Reimbursement_Amount__c=double.valueOf(PSReimAmt);
            

            system.debug(CCNCodestoupload.add(ICCN));
        }
        try{
        insert CCNCodestoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
    
    public List<CCN_Code_Entry__c> getuploadedCCNCodes()
    {
        if (CCNCodestoupload!= NULL)
            if (CCNCodestoupload.size() > 0)
                return CCNCodestoupload;
            else
                return null;                    
        else
            return null;
    }


}

 

I'm still learning apex so this might look odd...

 

In the following visualforce code I'm pulling a name and an id from 1 object. In a different object that same id is associated with a name. How would I be able to do a "join" in soql so that they can display the data properly?

 

<apex:page standardController="Contact" extensions="NL_Filter" action="{!doLoadAttachments}" id="page">
<apex:form id="form">
      <apex:outputPanel id="list" layout="block">
            <apex:pageBlock id="pb" title="Attachments" mode="view">
                <apex:pageBlockTable id="pbt" value="{!AttachmentList}" var="Attachment" >
                    <apex:facet name="header">
                        <apex:outputPanel layout="block">
                      </apex:outputPanel>
                       </apex:facet>
                    <apex:column headerValue="Title"> 
                        <apex:outputText value="{0}">
                            <apex:param value="{!Attachment.Name}"/>
                        </apex:outputText>
                    </apex:column>
                    <apex:column headerValue="Created By"> 
                        <apex:outputText value="{0}">
                            <apex:param value="{!Attachment.CreatedById}" />
                        </apex:outputText>
                    </apex:column>

                </apex:pageBlockTable> 
            </apex:pageBlock>
        </apex:outputPanel>   
</apex:form>
</apex:page>
public with sharing class NL_Filter{
	
	public Contact provider {get;set;}
	public List<Attachment> AttachmentList {get;set;}
	public List<Contact> ContactList {get;set;}
	public Map<Contact,Attachment> ContactAttachment {get;set;}
	
    public NL_Filter(ApexPages.StandardController controller) {

   	provider=(Contact)controller.getRecord();
   		
    }
	public PageReference doLoadAttachments(){
			final List<Attachment> Val=new List<Attachment>();		
			String query ='SELECT Name, LastModifiedDate, CreatedById FROM Attachment WHERE ParentId=\'0034000000KsrvZAAR\'';
   			String query2='Select Name, id from Contact where id=\'0034000000KsrvZAAR\'';
   			AttachmentList=Database.query(query);
   			ContactList=Database.query(query2);
   			
   			for(Contact Contacts:ContactList){
   				for(Attachment Attachments:AttachmentList){
   			
   				}
   			}

        return null;
    }

}

 

 

I followed this tutorial on drop down lists to the T and I'm still getting "line breaks not allowed in string literals" in my eclipse...http://www.soliantconsulting.com/blog/2009/07/the-user-visualforce-and-apex-about-a-drop-down-menu/

public with sharing class mc_FCCContractNegotiation {

   //==================================================
    // PROPERTIES
    //==================================================
    public mc_Price_Sheet_Code_Entry__c pricesheetCodeEntry {get;private set;}
    public mc_Carrier_Contract_Negotiation__c ContractNeg      {get;private set;}
    public List<mc_CodeEntry>              codeEntries         {get;private set;}
    public List<mc_CodeEntry>              SGcodeEntries         {get;private set;}
    public String                           lookupCode          {get;        set;}
    public ApexPages.StandardSetController  pricesheetEntries   {get;private set;}
    private List Ranks;
    private String Rank;
      



        public mc_FCCContractNegotiation(ApexPages.StandardController controller) {
       	getRank();
       	
        this.ContractNeg = (mc_Carrier_Contract_Negotiation__c)controller.getRecord();
        //codeEntries = mc_CodeEntry.load(contractNeg.id, ContractNeg.getInstance('Standard Charge - Current Year'));
        lookupCode = null;
    }
    
        public PageReference doLoadCodes(){
        SGcodeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, 'a2N400000004CKqEAM');
        codeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, ContractNeg.Code_Price_Sheet__c);
        doSpecifyReimbursementRate();
        
        return null;
    }
    
            public PageReference doSpecifyReimbursementRate(){
            mc_CodeEntry.calculateReimbursementAmount(SGcodeEntries, ContractNeg.Rate__c);
            mc_CodeEntry.calculateReimbursementAmount(codeEntries, ContractNeg.Rate__c);
        return null;
    }
    
   	    public String getRank(){
			return this.Rank;
    	}
    	
    }
    	public List getRanks() {
  			List Ranks= new List();
  			Ranks.add(new SelectOption('00','Selection'));
  			Ranks.add(new SelectOption('ED','ED'));
  			Ranks.add(new SelectOption(’MC’,'MC’));
  			Ranks.add(new SelectOption(’HM’,'HM’));
  			Ranks.add(new SelectOption(’UC’,'UC’));

  			return Ranks;
	}
    
    	public String getRank(){
  			int val=0;
  			if(Rank == ‘ED’){
    				val = 1;
  				}else{
  		  			if(Rank == ‘MC’){
    						val = 2;
  			 			}else{
  			   				if(Rank == ‘HM’){
    		          				val = 3;
  			       				}else{
  			       	 				if(Rank == ‘UC’){
    				        				val = 4;
  			       	 				}
  			   				}
  		  			}
  			}
    	
  	
  		
  	return Rank;
	}
    
}

 

Any ideas?

I'm trying to run a SOQL query to pull monitor information from our asset object. I'm new to salesforce so I'm not sure if my understanding is quite correct but if I could be pointed in the right direction that would be great.

 

The user enters a serial number to search for here

 

<apex:page controller="AssetManInputController">
<apex:form >
    <apex:pageBlock title="Monitor Search">
    <apex:outputLabel value="Serial Number" />:
    <apex:inputText value="{!searchString}" />
    <apex:facet name="footer">
        <apex:outputPanel >
            <apex:commandButton action="{!step2}" value="Search" />
        </apex:outputPanel>
    </apex:facet>
    </apex:pageBlock>
</apex:form>
</apex:page>

 

Once it's completed it redirects to this page to display the information but I get the error "Unknown property 'AssetManInputController.Acquistion_Date__c" 

 

<apex:page controller="AssetManInputController">
 
<apex:form >
    <apex:outputLabel value="Serial Number" />: 
    <apex:outputLabel value="{!SearchString}" /><br/>
    <apex:outputLabel value="Acquistion_Date__c"  for="{!Acquistion_Date__c}" /><br/>
    <apex:outputLabel value="Monitor_Manufacturer__c" for="{!Monitor_Manufacturer__c}" /><br/>
    <apex:outputLabel value="Monitor_Model__c" for="{!Monitor_Model__c}" /><br/>
</apex:form>


</apex:page>

 

Here's the soql query 

 

global with sharing class AssetManController 
{ 
 public IT_Asset__c ITO2 {get;set;}
 private String Serial,
                Manufacturer,
                Model;
 
       
      public IT_Asset__c getMonitorInfo(String Serial){
           IT_Asset__c c = [SELECT Acquistion_Date__c, Monitor_Manufacturer__c, Monitor_Model__c from IT_Asset__c WHERE Serial_Number__c = :Serial];
           IT_Asset__c l = new IT_Asset__c(Acquistion_Date__c=c.Acquistion_Date__c, Monitor_Manufacturer__c=c.Monitor_Manufacturer__c, Monitor_Model__c=c.Monitor_Model__c);
           return l;
      }
      
}

 The controller

public class AssetManInputController 
{

   private string Serial;
   public IT_Asset__c ITASSET {get; set;}
   AssetManController assetman = new AssetManController();
     
    public void setSearchString(String val) 
    {
        Serial = val;
    }

    public String getSearchString() 
    {
       return Serial;
    }

    public IT_Asset__c getAssets() 
    {
    	
        IT_Asset__c assets=assetman.getMonitorInfo(Serial);
        return assets;
    }

    public PageReference step2() 
    {
        return Page.assetman;
    }

}

 

 

 

I'm trying to create a workflow in a visualforce page and feel the components would help out tremendously because of the "rendered" option. What I'm trying to do is make a component visible when certain answers are returned. Is there a way to use standard controllers in a component or will I need to build the controls from scratch?

I'm trying to populate a list from a soql statment. It's currently populating 1 item but I'm not sure where the loop should go.

  <apex:selectList id="Modelbox" value="{!Models}" size="1" title="Type" onchange="searchServer(this.options[this.selectedIndex].text)">                                
  <apex:selectOptions value="{!items}"></apex:selectOptions>                              
  </apex:selectList>

 Here's the controller

    //Variables
    String[] models = new String[]{};

    
    //sobject
    public IT_Asset__c ITA {get;set;}
     
   
    public AssetManController() 
    {
     ITA=[SELECT Workstation_Model__c FROM IT_Asset__c]; 
        
    }
    public List<SelectOption> getItems() 
        {
        List<SelectOption> options = new List<SelectOption>();
        for(integer i=0;i<30;i++)
        {
        options.add(new SelectOption(ITA.Workstation_Model__c,ITA.Workstation_Model__c));
        }
        
        
        return options;
        }

       public string[] getModels()
       {
           return models;
       }
      public void setModels(string[] models)
       {
           this.models=models;
       }

 

 

 

This is my first real "project" regarding salesforce and apex so I'm not too familiar with it. What I would like to do is have a trigger use the asset's ID as a asset name if one isn't given. After doing some reading I think I have a good idea on what needs to be done but I keep getting a "DescriptionResourcePathLocationTypeSave error: Invalid initial type LIST<IT_Asset__c> for MAP<Name,String>" returned when I save it. Any ideas?

 

trigger AssetNamePopulate on IT_Asset__c (before insert, before update) 
{
	
	Set<Id> aids = new Set<Id> ();
	for (IT_Asset__c asset : Trigger.new) 
	{
		aids.add(asset.name); 
		
	}
    
	Map<Id, string> m = new Map<Id, string>([Select name, asset_name__c from IT_Asset__c where name in :aids]);

	for (IT_Asset__c asset : Trigger.new) 
	{
        if (asset.asset_name__c == null) 
        {
        	if (m.containsKey(asset.name)) 
        	{
        		asset.asset_name__c = m.get(asset.name);
        	}
        }
     }
	
	
}

 

The query I wrote is this...

Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c,
(Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c
from Qualification__c where Provider__c='00540000000x5ha' and RecordTypeId='01230000000DHlx'),
(Select id, License_Certificate_Number__c, Type__c, Start_Date__c, Expiration_Date__c, State__c
from Qualification__c where Provider__c='00540000000x5ha' and RecordTypeId='01230000000DHmR')

 I'm trying to get it to act similarly to this query in SQL....

SELECT a.name,a.Region__c ,rt.Name, 
 qd.Type__c DEAType ,qd.State__c  ,qd.License_Certificate_Number__c DEANumber ,
c.Name,c.GlobalProviderID__c
, qs.Type__c StateLincType,qs.License_Certificate_Number__c StateLinc,qs.State__c ,
qb.Type__c StateLincType,qb.License_Certificate_Number__c StateLinc,qb.State__c 
FROM dbo.Account a 
      INNER JOIN RecordType rt ON a.RecordTypeId =rt.Id 
      INNER JOIN dbo.Provider_Facility_Associations__c pfa on pfa.Hospital__c  =a.id
      INNER JOIN dbo.Contact c on c.id =pfa.Provider__c
      LEFT OUTER JOIN dbo.Qualification__c qD ON qd.Provider__c =c.id AND qd.RecordTypeId ='01230000000DHlxAAG' AND qd.Type__c ='DEA'
      LEFT OUTER JOIN dbo.Qualification__c qS ON qs.Provider__c =c.id AND qs.RecordTypeId ='01230000000DHlxAAG' AND qs.Type__c ='State Medical' AND qs.State__c =a.Physical_State__c
      LEFT OUTER JOIN dbo.Qualification__c qB ON qb.Provider__c =c.id AND qb.RecordTypeId ='01230000000DHmRAAW' 

 
I'm trying to display multiple qualification records in the same row of their associated contact. Any help would be greatly appreciated.

hi,

  

  i have a scenario that how to store mutilple radio buttons values into custom object through custom controller ......

please can any one tell????

 

 

thanks

Srikanth

Hi,

 

 I have some problem in my trigger. when i insert the single record its working perfect. But when i import bulk records it cause the Too many SOQL queries Error.

 

 Please help me:

 

trigger BazookaCode on Account(after insert)
{
string name,fname,lname,substr,anumber,code,code1,code2,code3,code4,code5;
String city='';
String state='';
Integer acount;
Integer acount1;
Set<id> aid = new Set<id>();

for(Account obj : Trigger.new)
{
aid.add(obj.id);
}

List<Account> la = [SELECT id,Name,ShippingCity,ShippingState,AccountNumber FROM Account WHERE id in :aid];
for(Account a : la)
{
if(a.AccountNumber == null)
{
name = a.Name;
fname = a.Name.mid(0,3);
substr = name.substringAfter(' ')+name;
lname = substr.mid(0,3);
city = a.ShippingCity.mid(0,3);
state = a.ShippingState.mid(0,2);

if(name!=substr)
{
code = fname+lname+state;
code1 = code.toUpperCase();
code2 = code1.replaceAll('\\W','');
acount = [SELECT COUNT() FROM Account WHERE AccountNumber LIKE :code2+'%'];
if(acount == 0)
{
a.AccountNumber = code2;
}
else if(acount > 0 && acount < 9)
{
a.AccountNumber = code2 + 0 + acount;
}
else
{
a.AccountNumber = code2 + acount;
}
}
else
{
code3 = fname+city+state;
code4 = code3.toUpperCase();
code5 = code4.replaceAll('\\W','');
acount1 = [SELECT COUNT() FROM Account WHERE AccountNumber LIKE :code5+'%'];
if(acount1 == 0)
{
a.AccountNumber = code5;
}
else if(acount1 > 0 && acount1 < 9)
{
a.AccountNumber = code5 + 0 + acount1;
}
else
{
a.AccountNumber = code5 + acount1;
}
}
update a;
}
}
}

  • November 21, 2012
  • Like
  • 0

I am using extension for a Custom Object .

Sample code:

 

<apex:page standardcontroller="Applied_SMP__c" extensions="ApplyAccountSMPAgain">
<apex:PageBlock >
<apex:pageMessages />
<apex:form >
<apex:pageblocksection title="Apply SMP" >
<apex:panelGrid columns="2">
<apex:panelGroup >
<b><label>SMP</label></b>&nbsp;&nbsp;&nbsp;&nbsp;
<apex:outputText value="{!name}"/>
</apex:panelGroup></apex:panelGrid>
<br/>
<apex:inputField value="{!Applied_SMP__c.Assign_To__c}"/>
<apex:inputField value="{!Applied_SMP__c.Start_Date__c}"/>
</apex:pageblocksection>

 

 

I want to use the user entered values in above two fields in controller.

How to capture these values in controller??

Please help

Hi,

 

I have created a input box and a link. When I click on the link, an alert will show the value of the input box. But this is not happening as of now, Please suggest the code changes. Thanks!

 

<apex:page id="pa">
 <apex:includeScript value="{!$Resource.jQuery}"/>
 <script type="text/javascript">
         var j$ = jQuery.noConflict();
         
         j$(document).ready(function(){
             j$("a").click(function(){
            var xyz = j$("#pa:f1:userInput").val();
            //var xyz = document.getElementById('{!$Component.pa.f1.userInput}').value;
             alert(xyz);
             });
        });         
  </script>

  <a herf="#" id="clickHere">click here</a>
  <apex:form id="f1">
      enter something <apex:inputText id="userInput"/>  
  </apex:form>
</apex:page>

 Thanks

Sam

 

 

Passing an id from jquery to the actionfunction so it can do a page redirect. I had it working but for some reason it's not passing an id anymore, just a null. When I do alert(id); in the function being called, the alert comes up with the requested id. For some reaosn the id seems to get lost when going from jQuery to the action function. Any idea why this might be happening?

        j$('#Edit_Asset').live('click', function(){
            callActionMethod();

        });
        function callActionMethod(){
 
            pgRedirect_EditAsset(id);
        }
          
    });
   
</script> 

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
</head>
<apex:form >
<apex:actionFunction name="pgRedirect_EditAsset" action="{!RedirectToEditAsset}" immediate="true">
    <apex:param name="IdParam" assignTo="{!AssetId}" value="" />
</apex:actionFunction>

 
Here's the apex

public String AssetId                               {get;set;} 
       public PageReference RedirectToEditAsset()
        {
            string url='/apex/AS_AssetEdit_m?id='+AssetId;
            PageReference pageRef = new PageReference(url);
           
           return pageRef;
            
        }

 

  • September 20, 2012
  • Like
  • 0

I have a jquery grid that created and filled with data after a search is complete. When you click on a row another div is created to display more information. Inside the div with more info is a button that should redirect you to another page while passing an id as an argument. The problem I'm having is when I try to use the onClick of the button for a page redirect it returns undefined. I was able to  j$('#Edit_Asset').live('click', function(){ to finally recognize the element and do the event...the only problem I have with this is when i use window.opener.location.href=document.domain+'/apex/AS_AssetEdit_m?id='+id; it doesn't go to the new page, it stays on the same page and reloads another instance of it. Anyone have any idea what else I could usei n jQuery to redirect the page?

Here's the code

<script>
    var j$ = jQuery.noConflict();
    var Results_Div=j$('#Results_Grid');
    var Results_Grid_Header=j$('#Results_Grid_Header');
    var QFilter;
    var SearchString;
    var PowersCombined;
    var oldResultElement;
    var id;
    var com;
    var res;
    j$(function() {    
       Results_Div=j$('#Results_Grid');
       QFilter=j$('#Query_Filter').val();
       SearchString=j$('#SearchBox').val();
       PowersCombined=QFilter+'°'+SearchString;
                       
           j$('#Search_Submit').click(function(){
                   
                  QFilter=j$('#Query_Filter').val();
                  SearchString=j$('#SearchBox').val();
                  PowersCombined=QFilter+'°'+SearchString;

                  Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AS_Viewer_m.getAssets}',
                  PowersCombined,
                  function(result, event)
                  { 
                      j$('#Results_Grid').children().remove();
                      id=result.id;
                      for(var b = 0; b < result.length; b++){
                          
                          j$('<div class="ui-grid-d" name="AssetGrid" id="AssetGrid'+result[b].Id+'" >'+
                              '<div class="ui-block-a"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Name+'</div></div>'+
                              '<div class="ui-block-b"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Model__r.Name+'</div></div>'+
                              '<div class="ui-block-c"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Serial_Number__c+'</div></div>'+
                              '<div class="ui-block-d"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].User+'</div></div>'+
                              '<div class="ui-block-d"><div class="ui-bar ui-bar-e" style="height:20px;width:200px">'+result[b].Acquisition_Date__c+'</div></div>'+
                              '<div id="AssetInfo'+result[b].Id+'" name="AssetInfo" style="width:1000px; margin:0 auto;"></div>'+
                            '</div>').appendTo(Results_Div);
                            
                      }
                            
                  },{escape: true});  
       
       });
       j$('#Results_Grid').on('click','div[name="AssetGrid"]', function(e) {
         j$('#DataDiv').empty().remove();

         if (oldResultElement!=null){
             j$(oldResultElement).children().remove();
            
         }

         var st=this.id;
         com='#AssetInfo'+st.substring(9);
         
         oldResultElement='#AssetInfo'+st.substring(9);

         Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.AS_Viewer_m.getAsset}',
            st.substring(9),
            function(result, event)
            {
             
             id=result.Id;

             if(result.RecordType.DeveloperName=='Infrastructure_Hardware'){

               j$('<div id="DataDiv" style="width:1000px; margin:0 auto;" style="width:1000px; margin:0 auto;">'+
               '<div style="width:500px;float:left;" id="MoData_LeftDiv">'+
               '<b>Asset Name: </b>'+result.Name+'<br/>'+
               '<b>Serial Number: </b>'+result.Serial_Number__c+'<br/>'+
               '<b>Model: </b>'+result.Model__r.Name+'<br/>'+
               '<b>Host Name: </b>'+result.Host_Name__c+'<br/>'+
               '<b>IP Address: </b>'+result.IP_Address__c+'<br/>'+
               '<b>MAC Address: </b>'+result.Mac_Address__c+'<br/>'+
               '<b>Comments: </b>'+result.Comments__c+'<br/>'+
               '</div>'+
               '<div style="float:left;width:300px;padding:0px 0px 0px 80px; id="MoData_MidDiv"">'+
               '<b>Account/Hospital: </b>'+result.Account_Hospital__c+'<br/>'+
               '<b>Date Lost/Stolen: </b>'+result.Date_Lost_Stolen__c+'<br/>'+
               '<b>Acquisition Date: </b>'+result.Acquisition_Date__c+'<br/>'+
               '<b>Decommission Date: </b>'+result.Decommission_Date__c+'<br/>'+
               '<b>Allocation: </b>'+result.User__c+'<br/>'+
               '</div>'+ 
               '<div style="width:80px;float:left;" id="MoData_RightDiv">'+
                      '<input type="image" src="{!URLFOR($Resource.Coquette, 'PNG/64x64/edit.png')}"  href="#" id="Edit_Asset"/><br/>'+
                      '<input type="image" src="{!URLFOR($Resource.Coquette, 'PNG/64x64/trash_can.png')}"  href="#" id="Delete_Asset"/>'+
               '</div>'+
               '<br style="clear:both;"/>'+
               '</div>').insertbefore(com);
               
                                                  
              }
            },{escape: true});
                           
        });

        j$('#Edit_Asset').live('click', function(){
            {!$Page.AS_AssetEdit_m}?id={!'+id+'}
            window.opener.location.href=document.domain+'/apex/AS_AssetEdit_m?id='+id;
        });
        

          
    });
   
</script> 

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
</head>
<apex:form >
<div data-role="header"> 
    <h1>Find Asset</h1> 
</div> 

<div id="Search_Div" class="Element_LeftAlign">
<input type="text" id="SearchBox" style="width:300px;display:inline;"/>
<button type="button" style="vertical-align:bottom;display:inline;" id="Search_Submit">Search</button>
    <select size="1" id="Query_Filter">
        <option value="00">--Please select--</option>
        <option value="01">Serial Number</option>
        <option value="02">Name</option>
        <option value="03">Allocated To</option>
        <option value="04">In Inventory</option>
    </select>
    <!--Make this a button that expands out-->
</div>
<div id="Results_Grid_Header" data-theme="d" style="display:inline;position:fixed;top:170px;">
<div class="ui-grid-d">
<div class="ui-block-a ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Name</b></div></div>
<div class="ui-block-b ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Model</b></div></div>
<div class="ui-block-c ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Serial Number</b></div></div>
<div class="ui-block-d ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Allocated To</b></div></div>
<div class="ui-block-e ui-li-count"><div class="ui-bar ui-bar-e" style="height:20px;width:200px"><b>Acquisition Date</b></div></div>
</div>
<div id="Results_Grid" class="" style="overflow:auto;height:350px;">

</div>
</div>




</apex:form>
</apex:page>

 

  • September 19, 2012
  • Like
  • 0

We want to be able to log an object for historical purposes but it's way too much data to do that through salesforce so I figured we could dump the data into a CSV file. I want to be able to dump the CSV file itself directly to the attachments object if that's possible. 

The way I'm currently generating the CSV file is by using the following in my visualforce page...

<apex:page standardController="Facility_Carrier_Contract__c" extensions="mc_FCCCodeHistory" id="page" standardStylesheets="false" showHeader="false" sidebar="false" contenttype="application/x-excel#export.csv">
{!exportData}</apex:page>

 

 

I'm trying to build a class that imports a .csv file. Everything works fine except for one field I need to import into. That field is a lookup for another object and I don't want to overwrite data in the object being looked up to...just the field making the lookup. ICCN.Code_Master_Reference__r = CM.id; is the culprit but I'm at a loss as to how I should do this. 

 

public with sharing class mc_CCNCodeImport {

    public string nameFile{get;set;}
    public Blob contentFile{get;set;}
    public string PSAmt {get;set;}
    public string PSReimAmt {get;set;}
    public Carrier_Contract_Negotiation__c CCN {get;set;}
    public String Delquery;
    public  List<CCN_Code_Entry__c> CCNCodestoupload {get;set;}
	public  List<Code_Master__c> CM {get;set;}
      
    String[] filelines = new String[]{};
   
    
   public mc_CCNCodeImport(ApexPages.StandardController controller){
    	this.CCN=(Carrier_Contract_Negotiation__c)controller.getRecord();
    }
   
 
    public Pagereference ReadFile()
    {
    	
    	Delquery='SELECT Code_Master_Reference__c, Pricesheet_Amount__c, Reimbursement_Amount__c FROM CCN_Code_Entry__c WHERE Carrier_Contract_Negotiation__c= \''+CCN.id+ '\'';
    	
    	CCN_Code_Entry__c[] doomedCodes=Database.query(Delquery);
    	
    	Database.Deleteresult[] DR_Dels=Database.delete(doomedCodes);
  
    	
        nameFile=contentFile.toString();
        filelines = nameFile.split('\n');
        CCNCodestoupload = new List<CCN_Code_Entry__c>();
		CM=new list<Code_Master__c>();
        for (Integer i=1;i<filelines.size();i++)
        {
            String[] inputvalues = new String[]{};
            inputvalues = filelines[i].split(',');
            
           	CCN_Code_Entry__c ICCN = new CCN_Code_Entry__c();

           	ICCN.Carrier_Contract_Negotiation__c=CCN.id;
           
           string query='SELECT id FROM Code_Master__c WHERE Name= \''+inputvalues[0]+ '\'';
           CM=Database.query(query);

           
           
           String PSReimAmt=String.valueOf(ICCN.Reimbursement_Amount__c);
       
             
           	ICCN.Code_Master_Reference__r = CM.id;
           	PSReimAmt=inputvalues[1];
            
            ICCN.Reimbursement_Amount__c=double.valueOf(PSReimAmt);
            

            system.debug(CCNCodestoupload.add(ICCN));
        }
        try{
        insert CCNCodestoupload;
        }
        catch (Exception e)
        {
            ApexPages.Message errormsg = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured. Please check the template or try again later');
            ApexPages.addMessage(errormsg);
        }    
        return null;
    }
    
    public List<CCN_Code_Entry__c> getuploadedCCNCodes()
    {
        if (CCNCodestoupload!= NULL)
            if (CCNCodestoupload.size() > 0)
                return CCNCodestoupload;
            else
                return null;                    
        else
            return null;
    }


}

 

I'm still learning apex so this might look odd...

 

In the following visualforce code I'm pulling a name and an id from 1 object. In a different object that same id is associated with a name. How would I be able to do a "join" in soql so that they can display the data properly?

 

<apex:page standardController="Contact" extensions="NL_Filter" action="{!doLoadAttachments}" id="page">
<apex:form id="form">
      <apex:outputPanel id="list" layout="block">
            <apex:pageBlock id="pb" title="Attachments" mode="view">
                <apex:pageBlockTable id="pbt" value="{!AttachmentList}" var="Attachment" >
                    <apex:facet name="header">
                        <apex:outputPanel layout="block">
                      </apex:outputPanel>
                       </apex:facet>
                    <apex:column headerValue="Title"> 
                        <apex:outputText value="{0}">
                            <apex:param value="{!Attachment.Name}"/>
                        </apex:outputText>
                    </apex:column>
                    <apex:column headerValue="Created By"> 
                        <apex:outputText value="{0}">
                            <apex:param value="{!Attachment.CreatedById}" />
                        </apex:outputText>
                    </apex:column>

                </apex:pageBlockTable> 
            </apex:pageBlock>
        </apex:outputPanel>   
</apex:form>
</apex:page>
public with sharing class NL_Filter{
	
	public Contact provider {get;set;}
	public List<Attachment> AttachmentList {get;set;}
	public List<Contact> ContactList {get;set;}
	public Map<Contact,Attachment> ContactAttachment {get;set;}
	
    public NL_Filter(ApexPages.StandardController controller) {

   	provider=(Contact)controller.getRecord();
   		
    }
	public PageReference doLoadAttachments(){
			final List<Attachment> Val=new List<Attachment>();		
			String query ='SELECT Name, LastModifiedDate, CreatedById FROM Attachment WHERE ParentId=\'0034000000KsrvZAAR\'';
   			String query2='Select Name, id from Contact where id=\'0034000000KsrvZAAR\'';
   			AttachmentList=Database.query(query);
   			ContactList=Database.query(query2);
   			
   			for(Contact Contacts:ContactList){
   				for(Attachment Attachments:AttachmentList){
   			
   				}
   			}

        return null;
    }

}

 

 

I followed this tutorial on drop down lists to the T and I'm still getting "line breaks not allowed in string literals" in my eclipse...http://www.soliantconsulting.com/blog/2009/07/the-user-visualforce-and-apex-about-a-drop-down-menu/

public with sharing class mc_FCCContractNegotiation {

   //==================================================
    // PROPERTIES
    //==================================================
    public mc_Price_Sheet_Code_Entry__c pricesheetCodeEntry {get;private set;}
    public mc_Carrier_Contract_Negotiation__c ContractNeg      {get;private set;}
    public List<mc_CodeEntry>              codeEntries         {get;private set;}
    public List<mc_CodeEntry>              SGcodeEntries         {get;private set;}
    public String                           lookupCode          {get;        set;}
    public ApexPages.StandardSetController  pricesheetEntries   {get;private set;}
    private List Ranks;
    private String Rank;
      



        public mc_FCCContractNegotiation(ApexPages.StandardController controller) {
       	getRank();
       	
        this.ContractNeg = (mc_Carrier_Contract_Negotiation__c)controller.getRecord();
        //codeEntries = mc_CodeEntry.load(contractNeg.id, ContractNeg.getInstance('Standard Charge - Current Year'));
        lookupCode = null;
    }
    
        public PageReference doLoadCodes(){
        SGcodeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, 'a2N400000004CKqEAM');
        codeEntries = mc_CodeEntry.load(ContractNeg.Facility_Carrier_Contract__c, ContractNeg.Code_Price_Sheet__c);
        doSpecifyReimbursementRate();
        
        return null;
    }
    
            public PageReference doSpecifyReimbursementRate(){
            mc_CodeEntry.calculateReimbursementAmount(SGcodeEntries, ContractNeg.Rate__c);
            mc_CodeEntry.calculateReimbursementAmount(codeEntries, ContractNeg.Rate__c);
        return null;
    }
    
   	    public String getRank(){
			return this.Rank;
    	}
    	
    }
    	public List getRanks() {
  			List Ranks= new List();
  			Ranks.add(new SelectOption('00','Selection'));
  			Ranks.add(new SelectOption('ED','ED'));
  			Ranks.add(new SelectOption(’MC’,'MC’));
  			Ranks.add(new SelectOption(’HM’,'HM’));
  			Ranks.add(new SelectOption(’UC’,'UC’));

  			return Ranks;
	}
    
    	public String getRank(){
  			int val=0;
  			if(Rank == ‘ED’){
    				val = 1;
  				}else{
  		  			if(Rank == ‘MC’){
    						val = 2;
  			 			}else{
  			   				if(Rank == ‘HM’){
    		          				val = 3;
  			       				}else{
  			       	 				if(Rank == ‘UC’){
    				        				val = 4;
  			       	 				}
  			   				}
  		  			}
  			}
    	
  	
  		
  	return Rank;
	}
    
}

 

Any ideas?