Tip 1: Avoid the most common error while using a Lookup in Deluge.

Tip 1: Avoid the most common error while using a Lookup in Deluge.



Hi everyone,


Today, we'll look at how to compare different data types. Like other programming languages, Deluge supports seven different kinds of data types -- String, Bigint, Decimal, Timestamp, Boolean, List, and Map. To perform particular actions, we often try to compare or match two different data types.

Let's look at a simple example:

In the below given IF condition, we are trying to check if the left expression which is a text field is equal to "Jack"


  1. if (input.name == "Jack")
  2. {
  3. alert "Hi Jack";
  4. }

As both the expressions are of the same data type, the code works perfectly fine.

But, if we try to match the value in a text field(of type string) with a integer, we would get an error: In Criteria left expression is of type STRING and right expression is of the type BIGINT.


  1. if(input.name == 2 )
  2. {
  3. alert "Hi Jack";
  4. }



Another common scenario: 


Users often get this error when they try to compare a Lookup value with a string. To explain this we have created two forms -- New Order Form and Record Inventory Details Form. 


New Order Form - Allows you to place an order for a new product.
Record Inventory Details - Stores the information about the products you have in your inventory.

The Select Product Field in the  New Order form is a Lookup field that displays product names fetched from the Record Inventory Details form.   

            


        

Case 1: Here we will use Fetch Records task to fetch records from a Record Inventory Details Form and use it to auto-populate the price based on the product selected(Product_Name) from the drop down(which is a Lookup). But, we get an error as shown below.


Note: itemDetails is a collection variable which is used to store all the details of that particular product. 





This is because the Lookup Field will lookup the ID of that particular record in the source Form. 

Solution: Hence, to avoid this error, we need to compare the Lookup field value to the ID of base record in source form as shown in below screenshot. You can also explore our Learn Deluge Tutorial to know more about other Deluge tasks.





Hope you got a fair idea on how to compare different data types and use Lookup field to perform particular actions. Keep watching this space for more such tips.





    Zoho Developer Community






                              Zoho Desk Resources

                              • Desk Community Learning Series


                              • Digest


                              • Functions


                              • Meetups


                              • Kbase


                              • Resources


                              • Glossary


                              • Desk Marketplace


                              • MVP Corner


                              • Word of the Day



                                  Zoho Marketing Automation


                                          Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now