• fred526
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi All

 

I am developing a VisualForce page and I need to pass a parameter to controller class. Why do I need to pass a parameter?, because I try to paint a table in HTML using a repeat apex component <apex:repeat>. The method called returns to VisualForce page a values map and I need to pass a key map to controller class.

 

Controller

 

public class claControlFormatoCotizacionSolicitud{ transient Map<String, Map<String, Double>> totalesAnticipos = new Map<String, Map<String, Double>>(); transient List<String> monedasAnticipos = new List<String>(); String tipoAnticipo {get;set;} public void calcularAnticiposSolicitud() { Map<String, String> monedasConsulta = new Map<String, String>(); List<Anticipo__c> consultaAnticipos = [SELECT Moneda__c, Tipo__c, Valor__c FROM Anticipo__c WHERE Solicitudes_de_viaje__c = :ApexPages.currentPage().getParameters().get('identificadorSolicitud') AND Tipo__c <> 'Tiquetes' AND IsDeleted = false ORDER BY Tipo__c ASC LIMIT 1000]; for(Anticipo__c registroAnticipo :consultaAnticipos) { monedasConsulta.put(registroAnticipo.Moneda__c, registroAnticipo.Moneda__c); } for(String monedaRegistro :monedasConsulta.values()) { monedasAnticipos.add(monedaRegistro); } monedasAnticipos.sort(); for(Anticipo__c registroAnticipo :consultaAnticipos) { if (totalesAnticipos.containsKey(registroAnticipo.Tipo__c)) { Map<String, Double> totalesTipo = totalesAnticipos.get(registroAnticipo.Tipo__c); if (totalesTipo.containsKey(registroAnticipo.Moneda__c)) { Double valorTotal = totalesTipo.get(registroAnticipo.Moneda__c); valorTotal = valorTotal + registroAnticipo.Valor__c; totalesTipo.put(registroAnticipo.Moneda__c, valorTotal); totalesAnticipos.put(registroAnticipo.Tipo__c, totalesTipo); } } else { Map<String, Double> totalesTipo = new Map<String, Double>(); for(String monedaTipo :monedasAnticipos) { if (monedaTipo == registroAnticipo.Moneda__c) { totalesTipo.put(registroAnticipo.Moneda__c, registroAnticipo.Valor__c); } else { totalesTipo.put(monedaTipo, 0); } totalesAnticipos.put(registroAnticipo.Tipo__c, totalesTipo); } } } } public List<String> getMonedasAnticipos() { return monedasAnticipos; } public List<String> getTiposAnticipos() { List<String> tiposAnticipos = new List<String>(); for(String tipoRegistro :totalesAnticipos.keySet()) { tiposAnticipos.add(tipoRegistro); } return tiposAnticipos; } public List<Double> getTotalesMonedas() { String tipoRegistro = System.currentPageReference().getParameters().get('tipoAnticipo'); List<Double> totalesTipo = totalesAnticipos.get(tipoRegistro).values(); return totalesTipo; } }

 

 VisualForce Page

 

<apex:page action="{!calcularAnticiposSolicitud}" controller="claControlFormatoCotizacionSolicitud" renderAs="pdf" showHeader="false" title="FTUG01 - Formato Solicitud Cotización de Tiquetes y Hotel"> <apex:form id="forCotizacionSolicitid"> <table border="1" width="100%"> <tr> <td></td> <apex:repeat value="{!MonedasAnticipos}" var="detalleMoneda"> <td><apex:outputText value="{!detalleMoneda}"/></td> </apex:repeat> </tr> <apex:repeat value="{!TiposAnticipos}" var="detalleTipo"> <tr> <td> <apex:outputText value="{!detalleTipo}"> <apex:param assignTo="{!tipoAnticipo}" name="tipoAnticipo" value="{!detalleTipo}"/> </apex:outputText> </td> <apex:repeat value="{!TotalesMonedas}" var="detalleTotal"> <td><apex:outputText value="{!detalleTotal}"/></td> </apex:repeat> </tr> </apex:repeat> </table> </apex:form></apex:page>

 

But when I execute the VisualForce page, the parameter "tipoAnticipo" is empty or null. 

 

 

 

Hi,
 
I am using Eclipse 3.3.2 and updated with the latest version of the Force.com IDE through Software Updates link. But the issue is eclipse is not loading Force.com toolkit so it is not shown any of the Force.com features on the eclipse. It is appreciated if sombody could help me to resolve this issue.
 
Regards,
John
  • September 10, 2008
  • Like
  • 0
I am trying to get the Stock Quote example (Apex Cookbook p.169) working. All the individual steps seem to work(?), at least no errors are being generated. But I can't get the Tab to get and display the stock quote. Has anyone gotten it to work?