Skipping rows with certain empty column fields .csv upload in Creator

Skipping rows with certain empty column fields .csv upload in Creator

Hi,

I have a script that parses data from an .csv  file upload and pushes the data into a Zoho Creator Form. 
The script below is supposed to assign "0" value to the empty fields and delete them from the upload if they match the criteria. Unfortunately, this is not working.

I would rather skip the records where these 2 column fields are both empty on a row - Cruise_Sales_2023 and Cruise_Sales_2022.

Please advise.

  1. fileContent = input.Cruise_Sales_Upload.content;
  2. rowlis = fileContent.toList("\n");
  3. i = 0;
  4. for each  rl in rowlis
  5. {
  6. if(i > 0 && i < rowlis.size() - 1)
  7. {
  8. lis = rl.toList();
  9. ppstfNewRecordID = insert into Preferred_Partner_Sales_Totals_Form
  10. [
  11. Added_User=zoho.loginuser
  12. Company_Sub_Type=lis.get(0)
  13. Luxury_Supplier=lis.get(1)
  14. Company_Name=lis.get(2)
  15. Cruise_Sales_2023=if(lis.get(3).tostring() == "",0,lis.get(3).todecimal())
  16. Cruise_Sales_2022=if(lis.get(4).tostring() == "",0,lis.get(4).todecimal())
  17. ];
  18. //fetch ppstf recird
  19. ppstfRecord = Preferred_Partner_Sales_Totals_Form[ID = ppstfNewRecordID];
  20. //
  21. //if(ppstfRecord.Company_Sub_Type = "Cruise Line" && ppstfRecord.Cruise_Sales_2023 = 0 && ppstfRecord.Cruise_Sales_2022 = 0 && ppstfRecord.Cruise_Sales_2020 = 0 && ppstfRecord.Cruise_Sales_2021 = 0)
  22. if(ppstfRecord.Company_Sub_Type = "Cruise Line" && ppstfRecord.Cruise_Sales_2023 = null && ppstfRecord.Cruise_Sales_2022 = null && ppstfRecord.Cruise_Sales_2020 = null && ppstfRecord.Cruise_Sales_2021 = null)
  23. {
  24. //
  25. delete from Preferred_Partner_Sales_Totals_Form[ID = ppstfNewRecordID];
  26. }
  27. }
  28. i = i + 1;
  29. info rowlis;
  30. }

Thanks, 
Jason

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly 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

                        • Word of the Day

                          Word of the Day


                        • 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

                        • Word of the Day

                          Word of the Day



                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方