You need to sign in to do that
Don't have an account?
Need help in SOQL Where clause.
Hello Everybody ,
My requirement is as follows .. plz go through and help me to solve this.
---> I am having one leave object with custom fields leave_from_date and leave_to_Date of Date type .
---> In the trigger which is on other object , i am have a Set collection of Dates i.e; Set<date>
----> I need to get all leave records using this set collection.
Example -- I am having the leave recpord with leave_from_date = 3-10-2013 and leave_to_ date = 05-10-2013 . And in the Set collection the available dates are (02-10-2013 and 04-10- 2013)
then What is the SOQL to get the leave record using this set collection..?
Thanx in advance
Hi Subbu,
I don't believe you can do what you want in a query.
The good news is with a bit of code before hand you can make it work. Bad news is if you have very, very, large date ranges you may hit script statment limits.
Here's the code:
Please be aware this was wrote in notepad++ so has not been compiled (so may need a little tweak or two) but it should be pretty close.
Hope this helps!
All Answers
Hi Subbu,
I am not sure if I fully understand what you want, but I think this should do it:
Hope this helps!
Hi Subbu,
Check if the below is what you are looking for,
Regards,
Ashish
@firechimp
I tried the same , but its not...
@Ashish
Can u plz let me know how to seperate refDate1 and refDate 2 from my Set Date collection..
Hi Subbu,
What error do you get when trying that?
@firechimp
Thanx for your response , it is not throwing any error , but the query is not getting the record i required ...
This is my requirement..
Leave record is available in leave object with field values as Leave_From_Date = 03/10/2013 and Leave_To_date = 05/10/2013.
i.e; total no. of leave days is 3 days .
&
In my trigger I am having the date collection(Set) which contains two values 02/10/2013 and 04/10/2013.
my requirement is to get the existing leave record using this date collection , because In need the leave record on 04/10/2013 also.
Hi Subbu,
I don't believe you can do what you want in a query.
The good news is with a bit of code before hand you can make it work. Bad news is if you have very, very, large date ranges you may hit script statment limits.
Here's the code:
Please be aware this was wrote in notepad++ so has not been compiled (so may need a little tweak or two) but it should be pretty close.
Hope this helps!
Thank u Gary , it worked ..but as you suggested I need to check this with large data sets ..
No Probs,
Glad I could help!