Cinchy Functions
1. Overview
The Cinchy functions covered in this section are:
resolveLink()
The resolveLink function is used to insert or update values for link columns. It can be used either with values in the target table or by using the Cinchy Id.
Using resolveLink against non-unique data values may not return the same data response each time; in that scenario we recommend that you resolve using the CinchyID instead.
Syntax
Example
currentUserID()
The currentUserID() function returns the currently logged in user's Cinchy Id. This is useful for setting up views as well as permissions.
Syntax
Example
You can use the below example in a view filter so that only the currently logged in user's tasks will appear.
currentUsersGroups()
The currentUsersGroups() function returns a list of the Cinchy Ids of groups that the current user belongs to, including any parent groups. For example, if a user is in the Cinchy Product
group and the Cinchy Product
group is under Cinchy Employees
, then both will be returned.
Syntax
Example
executeSavedQuery()
The executeSavedQuery function returns a scalar or list of scalar values from the saved query specified as the parameters of the function. There are two optional parameters for this function: CacheTimeout and RecordLimitForReturn.
Syntax
Example (Single Value)
Example (Multi Value)
Optional Parameter: Timeout
A cache expiry timeout for executeSavedQuery is an additional option that can be added. Simply add the number of seconds as a 3rd parameter to the function.
Optional Parameter: Record Limit
The RecordLimitForReturn parameter limits the amount of records returned. For example: If the query returns 10 records, but you set the parameter to 5, then you will get the first five records back.
GetLastModifiedBy()
The GetLastModifiedBy([Column]) function will return the CinchyID of the user who last modified the specified column. It is currently only supported in SELECT statements.
Value | Definiton |
Function Name | GetLastModifiedBy |
Function Description | This function function will return the CinchyID of the user who last modified the specified column. |
Function Type | Scalar |
Return Type | Numeric. It returns the CinchyID |
Syntax
Example
This example will return the CinchyID of the user who last modified the Name column in the Employees table.
draft([Column Name])
This function allows you to query for draft values on tables where Change Approval is enabled.
When querying for draft data, the query result type needs to be set to "Query Results (including Draft Data)"
Syntax
Example
In this example, we want to query all data in the Employees table, including the data that is pending a change request (Image 1).
![](https://platform.docs.cinchy.com/~gitbook/image?url=https%3A%2F%2F762429502-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MBtHkNqYteSDPDzpqqZ%252Fuploads%252FEX4mHbdyTav7cvRbiokn%252FRecords%2520with%2520Pending%2520Changes%2520in%2520the%2520table.jpg%3Falt%3Dmedia%26token%3Df4ad0030-bf67-4cf8-aebf-8a368618a4be&width=768&dpr=4&quality=100&sign=786795c9&sv=1)
To return results that include the draft changes in the First Name column, we would set our query results to Include Draft Data, and use the following syntax (Image 2):
![](https://platform.docs.cinchy.com/~gitbook/image?url=https%3A%2F%2F762429502-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MBtHkNqYteSDPDzpqqZ%252Fuploads%252F6nG4R3USwbDd0pwb1mBS%252Fimage.png%3Falt%3Dmedia%26token%3D6f911eb0-a4b8-46bb-ad40-314f16bd11fd&width=768&dpr=4&quality=100&sign=524804e8&sv=1)
Last updated