Tag Archives: snippet

List users per role

Admin Console of HR.Net allows only to list users by their primary role. And secondary roles are in a shade. To display all users that belong to a particular role (primary or secondary) you can use this bit of sql: … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Get parent_id from Javascript

Sometimes you need to get current record properties from the screen. Here is how to find Parent Record ID (if available), Current Record ID and table name for the current screen. Please note that a record can have no parent … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment

Buttons on forms?

Long time ago we needed to have a button on HRNET screen. If you work with HRNET, you know, there are no buttons available on the screens. Today almost no need for buttons, but I’ll tell you how the buttons … Continue reading

Posted in Uncategorized | Tagged , , , | 4 Comments

Function in computed field in temp table

It is not easy to set up function on computed field in temp table. I spent the whole day trying to resolve this… and here is the answer: use hrnetdev declare @functions nvarchar(4000) set @functions = ‘ use [tempdb] IF … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Parse Hrnet Date

Simple snippet for Custom Scripts: convert form HRNET date string into JavaScript format /** * Parce from string representind date in format “dd/mm/yyyy” into JavaScript Date format */ function parseDate(strDate){ var array = strDate.split(“/”); return new Date(array[2], array[1]-1, array[0], 0,0,0); … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Screen Validation

Many times I need to validate entries on the screen via JavaScript (or Custom Script, in terms of HR.Net). For about a year I struggled with validation via overloading function “Page_ClientValidate“. But when you overload this function, you can’t run … Continue reading

Posted in Uncategorized | Tagged , , , , , | 3 Comments

Regexp to validate MS SQL uniqueidentifier

I’m working on PHP project that interacts with HRNET and at some point I need to validate if given string is valid mssql guid. For this I use php regular expression: ^[0-9a-zA-Z]{8}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{4}-[0-9a-zA-Z]{12}$

Posted in Uncategorized | Tagged , , | 2 Comments

More JavaScript snippets

To open help screen: ShowHelp(); Returns true or false depending if the form validates or not. IsPageValid(); To switch screen into attached documents, print this setTimeout(“ShowAttachedDocs()”,0); if you print only ShowAttachedDocs() – this will give you an error when you … Continue reading

Posted in Uncategorized | Tagged , , , | 1 Comment

Find End of a Day for Given Date

Determines the last second for the day for the given date CREATE FUNCTION [dbo].[EndOfDay] ( @DATE DATETIME ) RETURNS DATETIME AS BEGIN RETURN DATEADD(s,-1,DATEADD(d, DATEDIFF(d,0,@DATE)+1,0)) END

Posted in Uncategorized | Tagged , , , | Leave a comment

Find Start of a Year for Given Date

Finds out a start of the year for the given date. CREATE FUNCTION [dbo].[StartOfYear] ( @DATE DATETIME ) RETURNS DATETIME AS BEGIN RETURN DATEADD(yy, DATEDIFF(yy,0,@DATE),0) END

Posted in Uncategorized | Tagged , , , | Leave a comment