• Nordine Bensadia
  • NEWBIE
  • 10 Points
  • Member since 2017

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

Please find below a sample of a batch apex code I am trying to update :;

global class BatchDeleteEmailAttachV2 implements Database.Batchable<sObject> {
    
  global Database.QueryLocator start(Database.BatchableContext BC){
        
        String query = 'SELECT Id FROM Attachment where Parent.Type = \'EmailMessage\' AND CreatedDate > 2016-01-01T00:00:00.000+0000 AND CreatedDate < 2017-01-01T00:00:00.000+0000';
       return Database.getQueryLocator(query);
     }
    
global void execute(Database.BatchableContext BC,List<sObject> attachments){
    Database.delete(attachments);
     }

This is working correctly, however I would like to use custome labels, so the date range can easily be updated. Here is what I have tried but the 

global class BatchDeleteEmailAttachV2 implements Database.Batchable<sObject> {
    
  global Database.QueryLocator start(Database.BatchableContext BC){
        
        String query = 'SELECT Id FROM Attachment where Parent.Type = \'EmailMessage\' AND CreatedDate > Label.BatchDeleteEmailAttach_FROM AND CreatedDate < Label.BatchDeleteEmailAttach_TO';
       return Database.getQueryLocator(query);
     }
    
global void execute(Database.BatchableContext BC,List<sObject> attachments){
    Database.delete(attachments);
     }

This is working with the value (2016-01-01T00:00:00.000+0000) but not with the custom label (Label.BatchDeleteEmailAttach_FROM).

Can anyone help please?

Thanks,

Nordine.
Hi,

I am trying to use selection binding in a SAQL Query but I always get this error : Binding has not been parsed or has validation errors

I want my SAQL step to be filtered by another step (based on another dataset).

Here is what I tried (I tried a lot of other things as well!) :

q = filter q by 'ParentId.Case_Language__c' in {{ column(Case_Language__c_1.selection, [\"Case_Language__c\"]).asObject()}};

I want the "ParentId.Case_Language__c" field in  my SAQL query to be filtered by the selction made on the "Case_Language__c" field from the "Case_Language__c_1" step.

Can anyone help?

Thanks :)

Nordine.
Hi,
I have an issue trying to build a table based on 3 different datasets.
This works, except I would like data from the 3 datasets to be filtered using only 1 calendar/date picker.
My date picker is named "Date_de_cr_ation_1".
Here is my SAQL below, could anyone help please? The issue must be on the "date filters" lines.

Thanks a lot for your help,

Nordine.


m = load "Email_Cases";
m = group m by 'ParentId.Case_Language__c';
m = filter m by 'Incoming' == "true";
m = filter m by date('MessageDate_Year', 'MessageDate _Month', 'MessageDate _Day') in {{selection(Date_de_cr_ation_1)}};
m = foreach m generate 'ParentId.Case_Language__c' as 'Case_Language__c', count() as 'mails';
f = load "Case_091116";
f = group f by 'Case_Language__c';
f = filter f by 'Is_Formulaire__c' == "true";
f = filter f by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in {{selection(Date_de_cr_ation_1)}};
f = foreach f generate 'Case_Language__c' as 'Case_Language__c', count() as 'formulaires';
c = load "Task_case_user_141116";
c = filter c by date('OdigoCti__Call_start_time__c_Year', 'OdigoCti__Call_start_time__c_Month', 'OdigoCti__Call_start_time__c_Day') in {{selection(Date_de_cr_ation_1)}};
c = group c by 'WhatId.Case_Language__c';
c = foreach c generate 'WhatId.Case_Language__c' as 'Case_Language__c', count() as 'calls';
cm = union f, m, c;
cm = group cm by 'Case_Language__c';
cm = foreach cm generate 'Case_Language__c' as 'Case_Language__c', sum('mails') as 'mails', sum('formulaires') as 'formulaires', sum('calls') as 'calls', (sum('mails') + sum('formulaires')) + sum('calls') as 'Total COntacts';
 
Hi all,

Please find below a sample of a batch apex code I am trying to update :;

global class BatchDeleteEmailAttachV2 implements Database.Batchable<sObject> {
    
  global Database.QueryLocator start(Database.BatchableContext BC){
        
        String query = 'SELECT Id FROM Attachment where Parent.Type = \'EmailMessage\' AND CreatedDate > 2016-01-01T00:00:00.000+0000 AND CreatedDate < 2017-01-01T00:00:00.000+0000';
       return Database.getQueryLocator(query);
     }
    
global void execute(Database.BatchableContext BC,List<sObject> attachments){
    Database.delete(attachments);
     }

This is working correctly, however I would like to use custome labels, so the date range can easily be updated. Here is what I have tried but the 

global class BatchDeleteEmailAttachV2 implements Database.Batchable<sObject> {
    
  global Database.QueryLocator start(Database.BatchableContext BC){
        
        String query = 'SELECT Id FROM Attachment where Parent.Type = \'EmailMessage\' AND CreatedDate > Label.BatchDeleteEmailAttach_FROM AND CreatedDate < Label.BatchDeleteEmailAttach_TO';
       return Database.getQueryLocator(query);
     }
    
global void execute(Database.BatchableContext BC,List<sObject> attachments){
    Database.delete(attachments);
     }

This is working with the value (2016-01-01T00:00:00.000+0000) but not with the custom label (Label.BatchDeleteEmailAttach_FROM).

Can anyone help please?

Thanks,

Nordine.
I am new to wave analytics ,
How to bind two datasets in a single dashboards