Deluge System Variables

Deluge System Variables

 Date Variables

 zoho.currentdate

Returns the current date as per the format set in the Application Settings.

zoho.currentdate

 zoho.currenttime

Returns the current date and time as per the format set in the Application Settings.

zoho.currenttime

Example 1:

To get the current date and time and input it into a field upon success,

  • Create a Date-time field, for example, named TimeStamp
  • In the onAdd ->on Success section and on Edit ->on Success sections of your Form, add the following script code, where zoho.currentime is the Deluge system variable which returns the current time. The current time will be updated in the field named TimeStamp. You can also disable the field so that it is not edited by users.
input.TimeStamp = zoho.currenttime;

Every record in every table (form) has two fields (Added Time and Last Modified Time) that ZOHO Creator automatically updates when ever a Form is clicked on the Submit or Update Buttons, so you could elect to show these fields in your List View. Refer the topic Display username and time  for more information.

  String Variables

  zoho.loginuser, zoho.loginuserid

User name and email address 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 them (i.e., based on their logged-in username or email address).

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

Zoho VariablePrivate app/Logged-in userPublic app/Logged-in userPublic app/Public user
zoho.loginuserUsername of the currently logged-in userPublicPublic
zoho.loginuseridEmail address of the currently logged-in usernullnull

Example 1:

In the following sample code, the username and userid field will display the current login user name and their email address.

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, they will see only their leave details.

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.loginuserid' is the deluge variable.

 zoho.adminuser, zoho.adminuserid

Username and email address 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 email address 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> == zoho.adminuserid]

  zoho.appname

The variable zoho.appname returns the name of the current application. This variable can be used in scripting to refer to the current application name, instead of actually specifying the application name. For example, to specify the URL in the Open URL Deluge task as, http://creator.zoho.com/<admin-user>/<application-name>/
we can specify the same as given below, to make the application portable. Here, baseURL is the varibale name which stores the URL string.

baseURL = (("http://creator.zoho.com/" + zoho.adminuser) + "/") + zoho.appname;

 zoho.ipaddress

The variable zoho.ipaddress returns the public IP address of the current user.

 zoho.appuri

The variable zoho.appuri will provide the application details in the format: /<admin_username>/<application_link_Name>/ . You may find this useful whilte mentioning your app's URL in tasks like open URL, or while constructing a file download link.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com