function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Bob AllenBob Allen 

Filter on TODAY() - Simple Filter to obtain record for current date

How does one apply Lens or SQL filter to obtain records for curent date?
This does not work for example;
q = filter q by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') == TODAY();
Shawn Reichner 29Shawn Reichner 29
It would be somethgn like this.... q = [SELECT ID, CreatedDate FROM Object__c WHERE CreatedDate = TODAY()];

You can also add any ther fields (Comma separated) to return via your query as well.

Does this help?

Shawn
Bob AllenBob Allen
Thanks Alain, this is SAQL.  I do receive an error message 

Invalid date range: date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["current day"] using the following statement;
q = filter q by date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day')  in ["current day"];

 
Alain CabonAlain Cabon
date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') in ["current day".."current day"] 

For an interval but it is not logical ("current day" is already an interval)
Bob AllenBob Allen
Unsupported type: UNKNOWN for arg1 (date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day')) of (date('CreatedDate_Year', 'CreatedDate_Month', 'CreatedDate_Day') == "current day")
Alain CabonAlain Cabon
Ok sorry, the last solution could be  in ["current day".."current day"] but it lacks this simple example in the documentation.
Bob AllenBob Allen
Thanks!
Alain CabonAlain Cabon
Good. When it works at last. ("current day" is already an interval like TODAY() in SOQL) and the simple example in ["current day".."current day"] is nowhere. The next time, I will test the solution myself before post it but it is more complicated with SAQL than with SOQL (curl and tokens) but the simple logic is not enough with these strange SAQL requests.
Bob AllenBob Allen
Thanks Bro. Appreciate your time and efforts. You are a Professional!
Alain CabonAlain Cabon
Good. Thanks and if your question is solved, you could close it (choosing an answer).
Alain
Ramakrishna Reddy GouniRamakrishna Reddy Gouni
[select id,Name from contact where createdDate=today]