You need to sign in to do that
Don't have an account?
laytro1978
Availability Checker
I have custom object with a
- name (unique)
- start date
- end date
I want create a VF / Apex availability checker to see where there are no records with the same name and date.
Any help much appreciated.
Thanks
R
No, this will not handle overlaps. It will only find identical record.
You'll need a more complex query to handle those situations. I think the following should handle the date side:
All Answers
Checking there are no others should be straightforward. In the example below the object is My_Custom_Object__c - replace this as needed. Note that I've retrieved the record rather than just a straightforward count, in case you want to add details to the error message
This will find objects that have the name 'Test Name', and a start/end date of today.
The Visualforce side of things really depends on your use case. Presumably you are capturing the name and start/end date into your controller? That being the case you could simply have a check availability command button that executes the above code.
Thanks Bob,
I have some time set aside tomorrow to have a go at the code. Will this handle overlaps, example;
No, this will not handle overlaps. It will only find identical record.
You'll need a more complex query to handle those situations. I think the following should handle the date side:
Hi Bob,
Thanks again for your help. I have been able to buy myself a lot more time by writing a report that shows booked days However I am still very keen to get this solution built and learn more about APEX.
I am working on a similar problem which I have gotten help for but I still can't get it to work. It's more or less the same problem but simpler.
I just want to return bookings that have a duration for a dynamic number of days. I was hoping when I cracked this I would be able to apply what I have learnt to the more complicated date query but I am struggling.
Code below, any pointers you can provide would be much appreciated.
Thanks again,
Ross
Here is the VF page
And the APEX code
T
Thanks Bob, all working now. The overlapping date code you gave me works great!
Hi Bob,
Sorry to ask but your code really helped me last time. And it's an expansion on the same problem. The code you provided works great for date searches within the criteria. Problem I now have is I need to return records that fall completely outside the exact search but have overlap.
So for example if my search is look for records that
start on the 3 March and end on the 8 March
I need to bring back records that start on the 1 March and end on the 10 March as the overlap the search above.
More information and all of my code is on the link is to the new post -> http://boards.developerforce.com/t5/Apex-Code-Development/Date-Problem/td-p/259943
Thanks again, and no problems if you can't help thanks for everything you have done.