• Luis Guilherme Marques Lino
  • NEWBIE
  • 0 Points
  • Member since 2018

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

I'm facing some trouble to GROUP BY a SELECT with 2 Child Objects. This is the following SELECT:
 
[SELECT Id AtendId, BI_BR_Adabas__c, BI_BR_Adabas__r.BI_BR_Parceiro__c, BI_BR_Cliente__c, BI_BR_Adabas__r.Modelo_de_Atuacao__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.Name, BI_BR_Adabas__r.BI_BR_Parceiro__r.BI_No_Identificador_fiscal__c, BI_BR_Escopo_de_Produto__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.BI_CAM_Codigo_del_cliente__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.Codigo_Grupo__c, BI_BR_Adabas__r.Name AdabasName FROM BI_BR_Atendimento_Comercial_e_Carteira__c WHERE BI_BR_Cliente__c = :lCliente AND BI_BR_Adabas__r.BI_BR_Parceiro__c != null AND BI_BR_Excluir__c = false AND BI_BR_Adabas__r.Modelo_de_Atuacao__c = :lMod GROUP BY BI_BR_Adabas__c, BI_BR_Cliente__c]



The BI_BR_Atendimento_Comercial_e_Carteira__c Object repeats N times for the same BI_BR_Adabas__c for each BI_BR_Cliente__c and as I only need one record (all data will repeat N times because they are the same datas in multiple records)

To achieve this I'm trying to GROUP BY EACH Adabas on EACH Account(BI_BR_Cliente__c).

I'm getting the following error:
 
​Line: 1, Column: 14 Field must be grouped or aggregated: Id

 
Hello!

I'm relatively new to Salesforce and I'm facing some difficulties to show the Visualforce Spinner during CSV Export.
Currently on my Visualforce I have the following code:
<apex:commandButton disabled="{! lPermissaoExportar }" status="pageStatus" action="{! botaoExportar }" value="Exportar" reRender="mensagem, pageStatus"/>

<apex:actionStatus id="pageStatus">
        <apex:facet name="start">
            <apex:outputPanel >
                <img src="/img/loading32.gif" width="25" height="25" />
                <apex:outputLabel value="Carregando..."/>
            </apex:outputPanel>
        </apex:facet>
  </apex:actionStatus>
And on my controller:
if (this.lInicio == null || this.lFim == null || this.lInicio > this.lFim)
{
	Mensagem_erro__c mensagem = Mensagem_erro__c.getInstance();
	String cMensagem = (mensagem.VF_importar_erro_data__c != null) ? mensagem.VF_importar_erro_data__c : 'Data não preenchida ou Data de inicio maior que a data fim!';
	setMensagem(cMensagem);
	return null;
}

PageReference pg = new PageReference('/apex//RelatorioCaseCSV');
pg.getParameters().put('Inicio', EncodingUtil.urlEncode( String.valueOf(this.lInicio), 'UTF-8'));
pg.getParameters().put('Fim', EncodingUtil.urlEncode( String.valueOf(this.lFim), 'UTF-8'));
pg.getParameters().put('Status', EncodingUtil.urlEncode( this.lFltStatusCaso , 'UTF-8'));
pg.getParameters().put('Tipo', EncodingUtil.urlEncode( this.lFltTipoCaso , 'UTF-8'));
return pg;

If the first verification fails I return null, if it's fine I generate the instance of my CSV Export page and returns it.

The main problem here is that whenever I return null, the spinner works fine stopping after the processing has ended.
But when I return the PageReference, even it just making an download of the csv file, it never stops and keeps spinning forever.
Can anyone help me to solve this issue?
To end with this development I must show to the user that "something is happening", while the download doesn't begin.

Thank you!
 

I'm facing some trouble to GROUP BY a SELECT with 2 Child Objects. This is the following SELECT:
 
[SELECT Id AtendId, BI_BR_Adabas__c, BI_BR_Adabas__r.BI_BR_Parceiro__c, BI_BR_Cliente__c, BI_BR_Adabas__r.Modelo_de_Atuacao__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.Name, BI_BR_Adabas__r.BI_BR_Parceiro__r.BI_No_Identificador_fiscal__c, BI_BR_Escopo_de_Produto__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.BI_CAM_Codigo_del_cliente__c, BI_BR_Adabas__r.BI_BR_Parceiro__r.Codigo_Grupo__c, BI_BR_Adabas__r.Name AdabasName FROM BI_BR_Atendimento_Comercial_e_Carteira__c WHERE BI_BR_Cliente__c = :lCliente AND BI_BR_Adabas__r.BI_BR_Parceiro__c != null AND BI_BR_Excluir__c = false AND BI_BR_Adabas__r.Modelo_de_Atuacao__c = :lMod GROUP BY BI_BR_Adabas__c, BI_BR_Cliente__c]



The BI_BR_Atendimento_Comercial_e_Carteira__c Object repeats N times for the same BI_BR_Adabas__c for each BI_BR_Cliente__c and as I only need one record (all data will repeat N times because they are the same datas in multiple records)

To achieve this I'm trying to GROUP BY EACH Adabas on EACH Account(BI_BR_Cliente__c).

I'm getting the following error:
 
​Line: 1, Column: 14 Field must be grouped or aggregated: Id

 
Hi Developers, i have one scenario to calculate Yearly average  based on the months.

Ex:
Monthly                              yearly                       results
january = 100  --->            (100)/1                       100
february= 200 --->            (100+200)/2                150
March =   300 --->             (100+200+300)/3        200
April    = 400--->                (100+200+300+400)/4...
------
-----
-----
December==1200          (100+200+300+400+... +1200)/12
  • January 15, 2018
  • Like
  • 0
Hello!

I'm relatively new to Salesforce and I'm facing some difficulties to show the Visualforce Spinner during CSV Export.
Currently on my Visualforce I have the following code:
<apex:commandButton disabled="{! lPermissaoExportar }" status="pageStatus" action="{! botaoExportar }" value="Exportar" reRender="mensagem, pageStatus"/>

<apex:actionStatus id="pageStatus">
        <apex:facet name="start">
            <apex:outputPanel >
                <img src="/img/loading32.gif" width="25" height="25" />
                <apex:outputLabel value="Carregando..."/>
            </apex:outputPanel>
        </apex:facet>
  </apex:actionStatus>
And on my controller:
if (this.lInicio == null || this.lFim == null || this.lInicio > this.lFim)
{
	Mensagem_erro__c mensagem = Mensagem_erro__c.getInstance();
	String cMensagem = (mensagem.VF_importar_erro_data__c != null) ? mensagem.VF_importar_erro_data__c : 'Data não preenchida ou Data de inicio maior que a data fim!';
	setMensagem(cMensagem);
	return null;
}

PageReference pg = new PageReference('/apex//RelatorioCaseCSV');
pg.getParameters().put('Inicio', EncodingUtil.urlEncode( String.valueOf(this.lInicio), 'UTF-8'));
pg.getParameters().put('Fim', EncodingUtil.urlEncode( String.valueOf(this.lFim), 'UTF-8'));
pg.getParameters().put('Status', EncodingUtil.urlEncode( this.lFltStatusCaso , 'UTF-8'));
pg.getParameters().put('Tipo', EncodingUtil.urlEncode( this.lFltTipoCaso , 'UTF-8'));
return pg;

If the first verification fails I return null, if it's fine I generate the instance of my CSV Export page and returns it.

The main problem here is that whenever I return null, the spinner works fine stopping after the processing has ended.
But when I return the PageReference, even it just making an download of the csv file, it never stops and keeps spinning forever.
Can anyone help me to solve this issue?
To end with this development I must show to the user that "something is happening", while the download doesn't begin.

Thank you!