Cinchy Functions


The currentUserID() function returns the current logged in user's Cinchy Id. This is useful for setting up views as well as permissions.

For example, I could create a view where [Assignee].[Cinchy Id] = currentUserID() is the filter to show My Tasks. I could also set a row level filter such that I can only edit rows where I am the assignee.


The currentUsersGroups() function returns a list of the Cinchy Ids of groups that the current user belongs to, including any parent groups (ex. If a user is in the Cinchy Product group and the Cinchy Product group is under Cinchy Employees, then both will be returned).

SELECT [Name] FROM [Cinchy].[Groups]
WHERE [Cinchy Id] IN (currentUsersGroups())


The executeSavedQuery function returns a scalar or list of scalar values from the saved query specified as the parameters of the function.

For example, the following are equivalent but the performance will be better when using executeSavedQuery.

Row Level Filter Example without executeSavedQuery

[Deparment] = (SELECT [Team] FROM [HR].[Employees]
WHERE [Cinchy User Account].[Cinchy Id] = currentUserID())

Row Level Filter Example with executeSavedQuery

[Department] = executeSavedQuery('HR','Get Department')

Saved Query: [HR].[Get Department]
SELECT [Team] FROM [HR].[Employees]
WHERE [Cinchy User Account].[Cinchy Id] = currentUserID()