Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to check the Calendar for an existing Vacation time

Posted on 2003-11-30
6
Medium Priority
?
274 Views
Last Modified: 2013-12-18
Hi Guys

I need to test somethiing

When a person books a holiday by setting a Startdate and an Endate it should check to see if the time has already been Approved or scheduled as vacation, Sick or any other Leave type. This has to be done against the name in the NameFull field.

So I Jack has already booked off Dec 1-3rd and Jill has Already booked of Dec 1 - 3rd and Jack then Books off Dec.1-3rd again it will prompt and say that Jack has already booked that time off.

James

0
Comment
Question by:adspmo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 1400 total points
ID: 9846641
Create a view with name as the I column sorted.

Do a dblookup like this on save or input validation (require to change prompt to failure and success functions resp)

temp := @DBLookup("Notes":"NoCache"; @DBName; FullName; "StartDate");
sDate := @IF(@ISError(temp); @Return(0); temp);
temp := @DBLookup("Notes":"NoCache"; @DBName; FullName; "EndDate");
eDate := @IF(@ISError(temp); @Return(0); temp);
Booked := @Explode( @TextToTime(@Text(sDate)) + "-" + @TextToTime(@Text(eDate)) );
CurrentDates := @Explode( @TextToTime(@Text(StartDate)) + "-" + @TextToTime(@Text(EndDate)) );
@if( @IsMember( CurrentDates; Booked) ; @Prompt([ok]; "Conflict"; "Already you have booked vacation on these dates"); "")

~Hemanth


0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9846646
Forgot to do this...Convert CurrentDates and Booked to text in @Ismember function.
0
 
LVL 31

Expert Comment

by:qwaletee
ID: 9850622
In the simple example you gave (Jack books the same exact set of days twice), it WILL be posible, because there will be an exact match.  But if theer is no exact match, you would not be ablet to key off the dates, because some part of teh dates would not match.

For example, if Jack already booked Dec 1-3, then tried to book Dec 2-4, there is no exact match, even though there is an "overlap match" if you consider all the in-between dates. (Dec 2 is the middle of the first booking and teh start of the second, whiel Dec 3 is the ned of teh first booking and themiddle of the second.)

You can get around this by getting a list of ALL dates a person has booked, so that you get back Dec 1, Dec 2, and Dec 3 for that first booking. You can then compare all the returned dates against all the dates in teh new booking.  That's basically what Hemantha has proposed, but is is somewhat inefficient to do this.

Another way would be to use script.  Have a view sort on the start dates.  Skip entried where the end is after the new attempted start, stop looking when the entry start is after the new attempted end, and anything you find in between indicates an overlap.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:adspmo
ID: 9850717
temp := @DbLookup( "" : "NoCache" ;""; "FullName" ; NameFull;"StartDate");
sDate := @If(@IsError(temp); @Return(0); temp);
temp1 := @DbLookup( "" : "NoCache" ;""; "FullName" ; NameFull;"EndDate");
eDate := @If(@IsError(temp1); @Return(0); temp1);
Booked := @Explode( @TextToTime(@Text(sDate)) + "-" + @TextToTime(@Text(eDate)) );
CurrentDates := @Explode( @TextToTime(@Text(StartDate)) + "-" + @TextToTime(@Text(EndDate)) );
@If( @Text(@IsMember( CurrentDates; Booked)) ; @Prompt([OK]; "Conflict"; "Already you have booked vacation on these dates"); "")

Here is what I have and it fails

Incorrect dataType blabla....NumberExpexted

I will be running this in my Submit button so it will fail and stop if there is a conflict

James
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 9850804
@Text(@IsMember( CurrentDates; Booked)) I meant to be like this

@ISMember(@Text(CurrentDates); @Text(Booked))
0
 

Author Comment

by:adspmo
ID: 9861234
bla
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question