Deluge System Variables

 

Date Variables

1. To get the current date

    zoho.currentdate()

2. To get the current time

    zoho.currenttime()

String Variables

1. Username and emailid of the logged in user is available as zoho variables in all the applications created using Zoho Creator. The variables zoho.loginuser and zoho.loginuserid can be used in scripting to write logic based on the user viewing your application. For example: You can have an application in Creator where you have data related to all your customers but you can make sure that each customer is able to view only those records that belong to him, based on their logged in username or emailid.

The table given below lists the zoho variables and value returned by the variables in a private and public application.

Zoho Variable Private app/Logged-in user Public app/Logged-in user Public app/Public user
zoho.loginuser Username of the currently logged-in user
Public Public
zoho.loginuserid Emailid of the currently logged-in user null null

Example 1:

In the following sample code, the username and userid field will display the current login user name and his emailid.

username
(
    type = formula
    value = zoho.loginuser
)

userid
(
    type = formula
    value = zoho.loginuserid
)

Example 2:

In a leave application, users will submit their leave in the leave form. When a user logs in, he will see only the leave details belonging to him.

list "My Leave Details"s
{ show all rows from emp_leave_form [Employee_email == zoho.loginuserid] ( Employee_email as "Employee email" Leave_type as "Leave type" From_Date as "From Date" To_Date as "To Date" Reason ) filters ( Leave_type From_Date ) }

Code Explanation:

[Employee_email == zoho.loginuserid] - The filter to display only the leave details of the current user

where,

- 'Employee_email' is a field in the form emp_leave_form
- 'zoho.emaild' is the deluge variable.

2. Username and emailid of the admin user is available as zoho variables in all the applications created using Zoho Creator. The variable zoho.adminuser returns the username of the application owner and the variable zoho.adminuserid returns the emailid of the application owner. These variables can be used in scripting to write logic based on the user viewing your application. For example, you can make sure that certain views can be accessed only by the admin user (application owner) by adding the following criteria to your view:

    show all rows from <form_name> [<email_field_name>l == zoho.adminuserid]