Updating Field ValuesThe topic illustrates the usage of the Deluge
Set <variable> statement in form action and field action scripts,
to set a value to a variable.
1. How can I update the name of the login user as a value for a field in my form ? To update a field with name of login user, write on add -> on load script and set the name field with zoho.loginuser , as shown below. You can also hide this field on form load, using the hide <field_name> syntax and set the value in the on success of the form.
2. How can I update a date field with current date on Form load? You can update a date field with current date, using zoho.currentdate()
Deluge function. In the following code, the Entry_Date field is
updated with the current date when the form is loaded for adding a new
record. The deluge Set Variable
statement is used to update the date field with the current date. The
syntax hide <field_name> will hide the Entry_Date
field, when the form is loaded for editing.
3. How can I update a URL field with a given url, link name and target? You can set a URL field type with the required URL, Link Name and Target using Set Variable Deluge statement. In the following sample code, input.Url_1 is the name of the url field in the form.
4. How can I update the value of a field in one form with the data fetched from another form? Refer the following sub topics under Tips & Tricks - Fetch and Update Records, to fetch records from another form and set the value in the current form. 5. If I enter 5 into the rate field, 5 into the hour field I want the amount field to add the rate * hour and show 25 in the amount field without hitting submit. How can I do this? If you look at Actions on User Input script of either the rate or hours form fields in this example, you'll see how each updates the amount field prior to any submit action. The sample application is available in the following link: http://creator.zoho.com/sampleapps/compute-rate-on-user-input/form/344/
6. I am trying to calculate unique commission rates for individual sales reps. Can I do this by creating formulas with If conditions? You cannot create formulas within If conditions. To calculate unique commission rates for individual sales reps, add on user input script to the Sales Rep field, and calculate the commission based on the sales rep selected. In the following sample code, Commission is a numeric field in the form. You can access the application from the following link: http://creator.zoho.com/sampleapps/commission/form/218
7. Everything we do is linked to a Job No. We want to calculate the profitability of each Job by £ and %. Hoe do I calculate the Profit% at a Job level ? Refer the sample application, Profit Calculation. The form "Details" is used to enter the cost price and selling price of each iteam specfic to a Job. The additional fields, Profit, PercentageProfit and AvgProfit are hidden in the On Load script of the Details form. The on success script, calculates the profit percent and the average profit.
Related Links Deluge Reference - Set Variable |