Solved

How to check the Calendar for an existing Vacation time

Posted on 2003-11-30
6
266 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
  • 3
  • 2
6 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 350 total points
Comment Utility
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
Comment Utility
Forgot to do this...Convert CurrentDates and Booked to text in @Ismember function.
0
 
LVL 31

Expert Comment

by:qwaletee
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:adspmo
Comment Utility
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
Comment Utility
@Text(@IsMember( CurrentDates; Booked)) I meant to be like this

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

Author Comment

by:adspmo
Comment Utility
bla
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now