Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Oliver843 Honored Contributor.
Honored Contributor.
916 views

Out of hours login variable logic

Jump to solution

Hello Comunity,

I am hoping someone could assist with a logic problem i am having.

Overview

I would like to create a rule that alerts me if a use has logged in outside of the hours of 06:00-18:00 and if they login on at any time during Saturday and Sunday.

I have created a rule to isolate the logon event and an active list with the relevent users contained in it and the rule works briliantly and currently brings back logon events for the users defined in the active list but the problem i am having is with the variables to get the times and dates working.

How I think it should work

I would use the time stamp variables to "GetHour" as an interger so an interger between 0-23 which will be the current time.

I then use the variable to "GetDayOfWeek" which gives me an interger of 1-7.

My question is once i have these variables how do i convert the endtime of the event to an interger so that i may compare the day and the hour to the variables i have previously.

Also once i have changed the "endtime" to a interger i am assuming i can then specify in the conditions endtime > 18 and endtime < 6 which should give me only the events between 06:00 and 18:00.

Has anyone does this before?

Am i on the right track?

Thanks for your assistance.

Regards

Oliver

Tags (3)
0 Likes
1 Solution

Accepted Solutions
Super Contributor.. s1ang Super Contributor..
Super Contributor..

Re: Out of hours login variable logic

Jump to solution

Hello!

Try to do this as in the screenshot.

GetDayOfWeek and CurrentHour are local variables.

GetDayOfWeek it's GetDayOfWeek function.

CurrentHour it's GetHour function.

image.png

0 Likes
4 Replies
Sumanth M Respected Contributor.
Respected Contributor.

Re: Out of hours login variable logic

Jump to solution
Re: Out of hours login variable logic

Hello Oliver,

Yes, you are on the right tarck 🙂

Just keep the condition as 

endTime > 18 OR endTime < 6 .  This will work.

And endTime here is the variable name you have created to extract the hour from the End Time. Better to keep the varaible name other than endTime here 🙂

Regards,

Sumanth

Oliver843 Honored Contributor.
Honored Contributor.

Re: Out of hours login variable logic

Jump to solution

Thanks Sumanth,

The hour part of the rule is working great, thanks.

Do you know how best to include the saturday and sunday part of the rule into this?

For example i would like to be emailed of a user logs in on a saturday or sunday so the time requirement is irrelevant here.

I was thinking a seperate rule may be the most efficiant way to accomplish this but i am eager to here your take on this.

Oliver

0 Likes
Super Contributor.. s1ang Super Contributor..
Super Contributor..

Re: Out of hours login variable logic

Jump to solution

Hello!

Try to do this as in the screenshot.

GetDayOfWeek and CurrentHour are local variables.

GetDayOfWeek it's GetDayOfWeek function.

CurrentHour it's GetHour function.

image.png

0 Likes
Oliver843 Honored Contributor.
Honored Contributor.

Re: Out of hours login variable logic

Jump to solution

Thanks, worked a treat

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.