Wednesday, May 22, 2013

How to fetch records from one table into another in Zoho Creator




The objective of this blog/video is to provide a complete example on how to fetch data from one table into another in Zoho Creator. The first thing that we're going to do is create a new table. So just for the sake of an example, we're going to have "visitors" in our data, and then we're going to create a new menu tab about the visitor.

You want to know its "name" and then, let's do an "email" field, a quick "email" field there and a "phone number". Then we're going to create an additional form and let's call this appointments. And I'll just create it under the tab "visitors" so that both tables are within the same place.

For appointments, we want to pick a visitor so we drag a look-up field. Notice how I chose the look-up field? then, we're going to name it "visitor" and we're going to select it from the table visitor. And we are going to bring the name of that particular visitor. We can actually add visitors from within this form by selecting the option within that form, we can also sort the visitors on alphabetical order and for now this should be enough.

But let's say that in addition to the visitor, obviously we will want to have a "date" for the appointment but we also need the email of this particular visitor, so that we're able to send him a note or something when we request the appointment. So, for the purpose of this example we're going to limit for the email option only.

And now you have two alternatives. You can either type the email of the visitor every time you create an appointment or we can automatically pull that information from the other table every time you select a visitor. So let's create some examples here. Let's go to visitor form. Then I'm going to input a few examples here. So let's do Joe Blow, email, joeblow@hotmail.com. This actually might be a real email so don't send to anybody, okay. We got Joe Blow, then Sue Blow email, sueblow@gmail.com. And we have a phone number there.Great!!!

Now if we go to the visitor's view there are two records that we just captured. Next we're going to link the information. And this is the objective of this blog/video. So you're going to go to visitor, and you want the system to create an action on your input, so you go to actions on user input, and then you are going to go to script builder form format and the first thing that we need to know &  to do is actually fetch the records. 

And we're going to call those visitors because we are pulling the visitor data from the visitor table into the appointment table....then we're going to select them from visitor's form and we want the name of the visitor to be equal to the visitor input field that you just selected. This is the key to link the information.

This process will pull the information about the visitor that you just selected on form view, and then all we need to do is set a variable name which in this case is going to be the email of the visitor, and we are going to go to collections to get the information about the visitors that we just fetched and assign the email to it.

Visitors email will be our new email name for it. And that's it, we just click "save." Go to the appointments table and every time you select a new visitor the system will automatically populate the email for you. If you go to Sue Blow now, Sue Blow email address appears on there. So I hope this exemplifies the way how you can fetch records from one table to another in Zoho Creator, good luck!

Thursday, May 16, 2013

How to give access to a developer in Zoho Creator


This is probably one of the top 20 most asked questions i seem to be answering all the time.when you are trying to share your work with a developer most of us believe its a 1 step process and we do know how to update / change the user status. However, there is an additional step  you need to consider to fully provide access to a developer to your Zoho Creator account. Please, review the slides for the 2 step process below and let me know if you have any questions.

2.1



2.2




Tuesday, May 14, 2013

How to update Unit Price into a subform based on Product selection



The sequence to execute the logic you are looking to accomplish is exactly as adding a script on a regular form.  On Add, On Delete, On User Input, but there is a subtle difference in the code and there is also a different way to embed the script into a subform, so lets tackle the way we embed the script.
On a regular form we have several options: Script Builder, Free Flow and Form Definition; where you can actually write the code manually if you know what you are doing. Inside a subform there is NO Script Builder that would guide you through the options of data you can access and a user is left with writing the code manually on a Free Flow approach style. The solution is to write the code using the Script Builder on a regular form save it from a free flow screen and take it into the subform corresponding action.
In the image below you will see an Order Management Form displaying regular fields about a Product and its Unit Price along with a subform that aggregates products in the same way. For the purpose of this example, we have created the script to update the Unit Price based on Product selection.
Now, notice how subtle the difference in the code is once we compare the lines of code that would update the fields on the right ( regular form ) to the ones on the left ( subform ) and you will see that they are nearly identical which provides us with a great opportunity to quickly incorporate scripts int any subform. Write the script on a regular form then paste it into the subform and correct the subtle difference.
SCRIPT FOR REGULAR FORM ON USER INPUT FOR ORDER ITEM.
//Fetches the information from the "Products" table
selected_Product = Products [Code = input.Order_Items];
//Updates the value of Unit Price using the stored value from "Products" table
input.Unit_Price = selected_Product.Price;
SCRIPT FOR SUBFORM ON USER INPUT FOR ORDER ITEM.
//Fetches the information from the "Products" table
selected_Product = Products [Code = row.Order_Items];
//Updates the value of Unit Price using the stored value from "Products" table
row.Unit_Price = selected_Product.Price;
Notice that the only difference between the 2 is the word row. before the field value of the subform. With this knowledge you can now write the script you need on a regular form by simulating the subform fields, import the code and modify with the word row. as needed.