-
ChatterFeed
-
0Best Answers
-
1Likes Received
-
0Likes Given
-
10Questions
-
13Replies
Formating Double to two Decimal Places
Hello...
Im having one problem trying to convert values to show on my visualforce page:
How can i convert the following number to have to decimal places...
Sometimes i ll have a number like. 42.0 other time i ll have a number like 37.3333333333333
Im trying to solve it using what i found here. but the problem is always the same.
Tks for everything
- Marcelo Agostinho
- January 18, 2011
- Like
- 0
- Continue reading or reply
Getting Value from Lookup
<apex:page controller="CarteiraCliente" action="{!teste}" sidebar="false" contentType="{!contentType}"> <apex:pageBlock rendered="{!showFilter}" > <apex:form > <p> Vendedor <apex:inputField id="vendedor" value="{!filtro.Vendedor__c}" required="false" /> </p> <p> Supervisor <apex:inputField id="supervisor" value="{!filtro.Vendedor__r.Supervisao_Vendedor__c}" required="false"/> </p> <apex:commandButton value="Filtrar" action="{!teste}" reRender="carteiraCliente" /> </apex:form> </apex:pageBlock> <apex:pageBlock id="carteiraCliente" title="{!title}"> <apex:pageBlockTable value="{!valoresClienteMes}" var="cliente" title="Carteira de Cliente"> <apex:column headerValue="Vendedor" id="nomeVendedor" value="{!cliente.nomeVendedor}" /> <apex:column headerValue="Nome" id="nomeCliente" value="{!cliente.nomeCliente}" /> <apex:column headerValue="valorTreze" id="valorTreze" value="{!cliente.valorTreze}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
My Controller
public class CarteiraCliente { public MovimentoMes__c filtro { get; set; } public CarteiraCliente() { filtro = new MovimentoMes__c(); showFilter = false; } public aMethod(){ .............. String paramVendedor = filtro.Vendedor__c; System.Debug ('=====' +paramVendedor+ '====='); String paramSupervisor = filtro.Vendedor__r.Supervisao_Vendedor__c; System.Debug ('=====' +paramSupervisor+ '====='); ............. }
On my VF Page, when i get a value from lookup icon and click to go... i get the value on my Apex Class...
but on my second field i alwas get null....
What's happening? And what i can do to solve it?
Tks again for everything
- Marcelo Agostinho
- January 10, 2011
- Like
- 0
- Continue reading or reply
Problems converting VIsualForce Page to Excel
Hello!
Well, i tried some examples of how to convert VF to Excel, and i did it with sucess.
But now when i convert my own VF Page to Excel, apparently it works fine, but when i try to open, the excel give the following message
"Cant read the file",
Here is the code...
<apex:page controller="CarteiraCliente" sidebar="false" contentType="application/vnd.ms-excel"> <apex:pageBlock> <apex:form> <apex:commandButton value="Carrega Tabela" action="{!teste}"/> </apex:form> </apex:pageBlock> <apex:pageBlock title="Carteira de Cliente"> <apex:pageBlockTable value="{!valoresClienteMes}" var="cliente" title="Carteira de Cliente"> <apex:column id="nomeCliente" value="{!cliente.nomeCliente}"/> <apex:column id="valorTreze" value="{!cliente.valorTreze}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
Tks!!!
- Marcelo Agostinho
- January 06, 2011
- Like
- 0
- Continue reading or reply
Changing API Version to Use one Feature
Hello Developers, how are you doing?
Well, again i'm here to do some questions,
Actually, i'm developing a table on avisualforce page, using Visualforce Tags.
I'm doing it using VF Tags, because i ll need to change the content type to generate a XLS file.
Reading about VF to XLS, i see this to solve my problems, well its work.
But now i need to iterate over an list, and generate a column for each value.
When i tried to use the following code:
<apex:pageBlock> <apex:pageBlockTable value="{!valoresClienteMes}" var="omg" title="Teste"> <apex:column id="teste1" width="100px" value="{!omg.nomeCliente}"/> <apex:repeat value="{!omg.valoresMeses}" var="valor"> <apex:column id="teste2" width="100px" value="{!valor}"/> </apex:repeat> </apex:pageBlockTable> </apex:pageBlock>
I got this message...
Error: <apex:column> may be child of <apex:repeat> only for the API version 20 or later
What can i do?
Tks for everything again =)
- Marcelo Agostinho
- January 04, 2011
- Like
- 0
- Continue reading or reply
Creating Table with Apex...
01/2010 - Customer 1Customer 1Hello... sorry but i dont know if this is the best Board to post my question.
Well... actually i need to create a table getting datas from a map...
private List<MovimentoMes__c> movimentosClientes = [Select m.Vendedor__r.Name, m.Cliente__r.cliente__c, m.Cliente__r.campoLivreAlt__c , m.Cliente__r.municipio__c , m.Cliente__r.uf__c ,m.Mes_de_Referencia__c, m.Valor__c From MovimentoMes__c m]; public void mapClienteValorMeses(){ clienteFaturamentoMes = new Map<String,Map<String,Double>>(); for(MovimentoMes__c movimento: movimentosClientes){ cliente = movimento.Cliente__r.cliente__c; mesDeReferencia = movimento.Mes_de_Referencia__c; valorMesReferencia = movimento.Valor__c; if(clienteFaturamentoMes.containsKey(cliente)){ faturamentoMes = clienteFaturamentoMes.get(cliente); if(faturamentoMes.containsKey(mesDeReferencia)){ totalMes = faturamentoMes.get(mesDeReferencia); totalMes += valorMesReferencia; faturamentoMes.put(mesDeReferencia,totalMes); }else{ faturamentoMes.put(mesDeReferencia,valorMesReferencia); } } else { faturamentoMes = new Map<String,Double>(); faturamentoMes.put(mesDeReferencia,valorMesReferencia); clienteFaturamentoMes.put(cliente,faturamentoMes); } } }
Explaining the code above.
My external map receive a customer (String) as Key, and an Map(String,Double) as Value, and the Internal Map Receive a Month of Purchase(String) as Key and a Value of Purchase(Double) as Value.
So where is my problem....
Considering 12 month (Not exactly all months of the same year)... some customers bought something on month 01, 02, 03, and another bought something on month, 04,06,08...
I know exactly the12 month period, where it begin and where it end...
What i need to do is something like it:
A table where the first column is the name of the customer...the first row is the header with all the month period...
But i said before some customers doesnt buy all months... and this data will not exist at Map... so if one customer doesnt buy one month... at table this need to appear with 0, how i can do it?
Well sorry about my english =)
Very thanks for everything!
- Marcelo Agostinho
- December 20, 2010
- Like
- 0
- Continue reading or reply
Round a number
Hello. Again i'm here to make some questions.
I'm building an URL to send it ro Google Chart API and it will return an image.
What i need to do is get the maximum value of the Chart data and round up it to An integer...
For example...
If my maximum value is 2475.59 i want to convert it to a string and round up to 2500.
Can i do it?
Anyone can help me?
Tks
- Marcelo Agostinho
- December 10, 2010
- Like
- 0
- Continue reading or reply
Can i parse an String to Date ?
Hello again.
Well everybody`s know about the SimpleDateFormat class in Java, i'm looking for something like it in the Apex Code.
What i need to do is:
I ll receive an set of String containing some formated Datas like it "10/2010".
I want to iterate over this set and convert any String to Date and populate one List<Date>.
Tks for everything!
- Marcelo Agostinho
- December 08, 2010
- Like
- 0
- Continue reading or reply
Sorting a Map
Hello, everybody!
Again, i'm here to do some questions...
I have the following code...
public Map<String,Double> calculaFaturamentoMensal(){ Double soma; Map<String,Double> faturamentoMensal = new Map <String,Double>(); for(MovimentoMes__c movimento : [Select m.Valor__c, m.Mes_de_Referencia__c From MovimentoMes__c m]){ if(faturamentoMensal.containsKey(movimento.Mes_de_Referencia__c)){ soma = 0; soma = faturamentoMensal.get(movimento.Mes_de_Referencia__c); soma += movimento.Valor__c; faturamentoMensal.put(movimento.Mes_de_Referencia__c,soma); } else { faturamentoMensal.put (movimento.Mes_de_Referencia__c,movimento.Valor__c); } } return faturamentoMensal; }
After this, i want to sort my map by the key... trying to ensure that when I iterate over the map ill have the values based on the crescent sequence of the key...
Tks for all
- Marcelo Agostinho
- December 07, 2010
- Like
- 1
- Continue reading or reply
How can i export XLS using Apex Class?
Hello Guys... im here again to ask about exporting XLS.
For example i want to run a method that is associated to a commandButtom...
when i click in this commandButtom... this method is called and they will return the datas ready to export to a XLS file...
Can i do something like it?
- Marcelo Agostinho
- November 30, 2010
- Like
- 0
- Continue reading or reply
VF Fields to Apex Class Parameters! How can i do it?
Hello guys! Im having some problems trying to find how can i pass a value from a field for an Apex Class parameter
For exemple
My simple VF Page.
<apex:page controller="ProcessDataLoad"> <apex:form > <p> Actual Date (mm/aaaa)<apex:inputText id="actualDate"/> </p> <p> Month Quantity<apex:inputText id="qtdMonth"/> </p> <apex:commandButton value="Test"/> </apex:form> </apex:page>
And now i want to now how can i get these value in my Apex class when i click on commandButton?
Thanks for all!
Marcelo Agostinho
- Marcelo Agostinho
- November 22, 2010
- Like
- 0
- Continue reading or reply
Sorting a Map
Hello, everybody!
Again, i'm here to do some questions...
I have the following code...
public Map<String,Double> calculaFaturamentoMensal(){ Double soma; Map<String,Double> faturamentoMensal = new Map <String,Double>(); for(MovimentoMes__c movimento : [Select m.Valor__c, m.Mes_de_Referencia__c From MovimentoMes__c m]){ if(faturamentoMensal.containsKey(movimento.Mes_de_Referencia__c)){ soma = 0; soma = faturamentoMensal.get(movimento.Mes_de_Referencia__c); soma += movimento.Valor__c; faturamentoMensal.put(movimento.Mes_de_Referencia__c,soma); } else { faturamentoMensal.put (movimento.Mes_de_Referencia__c,movimento.Valor__c); } } return faturamentoMensal; }
After this, i want to sort my map by the key... trying to ensure that when I iterate over the map ill have the values based on the crescent sequence of the key...
Tks for all
- Marcelo Agostinho
- December 07, 2010
- Like
- 1
- Continue reading or reply
Formating Double to two Decimal Places
Hello...
Im having one problem trying to convert values to show on my visualforce page:
How can i convert the following number to have to decimal places...
Sometimes i ll have a number like. 42.0 other time i ll have a number like 37.3333333333333
Im trying to solve it using what i found here. but the problem is always the same.
Tks for everything
- Marcelo Agostinho
- January 18, 2011
- Like
- 0
- Continue reading or reply
Getting Value from Lookup
<apex:page controller="CarteiraCliente" action="{!teste}" sidebar="false" contentType="{!contentType}"> <apex:pageBlock rendered="{!showFilter}" > <apex:form > <p> Vendedor <apex:inputField id="vendedor" value="{!filtro.Vendedor__c}" required="false" /> </p> <p> Supervisor <apex:inputField id="supervisor" value="{!filtro.Vendedor__r.Supervisao_Vendedor__c}" required="false"/> </p> <apex:commandButton value="Filtrar" action="{!teste}" reRender="carteiraCliente" /> </apex:form> </apex:pageBlock> <apex:pageBlock id="carteiraCliente" title="{!title}"> <apex:pageBlockTable value="{!valoresClienteMes}" var="cliente" title="Carteira de Cliente"> <apex:column headerValue="Vendedor" id="nomeVendedor" value="{!cliente.nomeVendedor}" /> <apex:column headerValue="Nome" id="nomeCliente" value="{!cliente.nomeCliente}" /> <apex:column headerValue="valorTreze" id="valorTreze" value="{!cliente.valorTreze}" /> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
My Controller
public class CarteiraCliente { public MovimentoMes__c filtro { get; set; } public CarteiraCliente() { filtro = new MovimentoMes__c(); showFilter = false; } public aMethod(){ .............. String paramVendedor = filtro.Vendedor__c; System.Debug ('=====' +paramVendedor+ '====='); String paramSupervisor = filtro.Vendedor__r.Supervisao_Vendedor__c; System.Debug ('=====' +paramSupervisor+ '====='); ............. }
On my VF Page, when i get a value from lookup icon and click to go... i get the value on my Apex Class...
but on my second field i alwas get null....
What's happening? And what i can do to solve it?
Tks again for everything
- Marcelo Agostinho
- January 10, 2011
- Like
- 0
- Continue reading or reply
Problems converting VIsualForce Page to Excel
Hello!
Well, i tried some examples of how to convert VF to Excel, and i did it with sucess.
But now when i convert my own VF Page to Excel, apparently it works fine, but when i try to open, the excel give the following message
"Cant read the file",
Here is the code...
<apex:page controller="CarteiraCliente" sidebar="false" contentType="application/vnd.ms-excel"> <apex:pageBlock> <apex:form> <apex:commandButton value="Carrega Tabela" action="{!teste}"/> </apex:form> </apex:pageBlock> <apex:pageBlock title="Carteira de Cliente"> <apex:pageBlockTable value="{!valoresClienteMes}" var="cliente" title="Carteira de Cliente"> <apex:column id="nomeCliente" value="{!cliente.nomeCliente}"/> <apex:column id="valorTreze" value="{!cliente.valorTreze}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:page>
Tks!!!
- Marcelo Agostinho
- January 06, 2011
- Like
- 0
- Continue reading or reply
Changing API Version to Use one Feature
Hello Developers, how are you doing?
Well, again i'm here to do some questions,
Actually, i'm developing a table on avisualforce page, using Visualforce Tags.
I'm doing it using VF Tags, because i ll need to change the content type to generate a XLS file.
Reading about VF to XLS, i see this to solve my problems, well its work.
But now i need to iterate over an list, and generate a column for each value.
When i tried to use the following code:
<apex:pageBlock> <apex:pageBlockTable value="{!valoresClienteMes}" var="omg" title="Teste"> <apex:column id="teste1" width="100px" value="{!omg.nomeCliente}"/> <apex:repeat value="{!omg.valoresMeses}" var="valor"> <apex:column id="teste2" width="100px" value="{!valor}"/> </apex:repeat> </apex:pageBlockTable> </apex:pageBlock>
I got this message...
Error: <apex:column> may be child of <apex:repeat> only for the API version 20 or later
What can i do?
Tks for everything again =)
- Marcelo Agostinho
- January 04, 2011
- Like
- 0
- Continue reading or reply
Round a number
Hello. Again i'm here to make some questions.
I'm building an URL to send it ro Google Chart API and it will return an image.
What i need to do is get the maximum value of the Chart data and round up it to An integer...
For example...
If my maximum value is 2475.59 i want to convert it to a string and round up to 2500.
Can i do it?
Anyone can help me?
Tks
- Marcelo Agostinho
- December 10, 2010
- Like
- 0
- Continue reading or reply
Can i parse an String to Date ?
Hello again.
Well everybody`s know about the SimpleDateFormat class in Java, i'm looking for something like it in the Apex Code.
What i need to do is:
I ll receive an set of String containing some formated Datas like it "10/2010".
I want to iterate over this set and convert any String to Date and populate one List<Date>.
Tks for everything!
- Marcelo Agostinho
- December 08, 2010
- Like
- 0
- Continue reading or reply
Sorting a Map
Hello, everybody!
Again, i'm here to do some questions...
I have the following code...
public Map<String,Double> calculaFaturamentoMensal(){ Double soma; Map<String,Double> faturamentoMensal = new Map <String,Double>(); for(MovimentoMes__c movimento : [Select m.Valor__c, m.Mes_de_Referencia__c From MovimentoMes__c m]){ if(faturamentoMensal.containsKey(movimento.Mes_de_Referencia__c)){ soma = 0; soma = faturamentoMensal.get(movimento.Mes_de_Referencia__c); soma += movimento.Valor__c; faturamentoMensal.put(movimento.Mes_de_Referencia__c,soma); } else { faturamentoMensal.put (movimento.Mes_de_Referencia__c,movimento.Valor__c); } } return faturamentoMensal; }
After this, i want to sort my map by the key... trying to ensure that when I iterate over the map ill have the values based on the crescent sequence of the key...
Tks for all
- Marcelo Agostinho
- December 07, 2010
- Like
- 1
- Continue reading or reply
VF Fields to Apex Class Parameters! How can i do it?
Hello guys! Im having some problems trying to find how can i pass a value from a field for an Apex Class parameter
For exemple
My simple VF Page.
<apex:page controller="ProcessDataLoad"> <apex:form > <p> Actual Date (mm/aaaa)<apex:inputText id="actualDate"/> </p> <p> Month Quantity<apex:inputText id="qtdMonth"/> </p> <apex:commandButton value="Test"/> </apex:form> </apex:page>
And now i want to now how can i get these value in my Apex class when i click on commandButton?
Thanks for all!
Marcelo Agostinho
- Marcelo Agostinho
- November 22, 2010
- Like
- 0
- Continue reading or reply