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.
- fileContent = input.Cruise_Sales_Upload.content;
- rowlis = fileContent.toList("\n");
- i = 0;
- for each rl in rowlis
- {
- if(i > 0 && i < rowlis.size() - 1)
- {
- lis = rl.toList();
- ppstfNewRecordID = insert into Preferred_Partner_Sales_Totals_Form
- [
- Added_User=zoho.loginuser
- Company_Sub_Type=lis.get(0)
- Luxury_Supplier=lis.get(1)
- Company_Name=lis.get(2)
- Cruise_Sales_2023=if(lis.get(3).tostring() == "",0,lis.get(3).todecimal())
- Cruise_Sales_2022=if(lis.get(4).tostring() == "",0,lis.get(4).todecimal())
- ];
- //fetch ppstf recird
- ppstfRecord = Preferred_Partner_Sales_Totals_Form[ID = ppstfNewRecordID];
- //
- //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)
- 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)
- {
- //
- delete from Preferred_Partner_Sales_Totals_Form[ID = ppstfNewRecordID];
- }
- }
- i = i + 1;
- info rowlis;
- }
Thanks,
Jason
Access your files securely from anywhere
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
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 Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.