Can I insert rows (add records) using criteria in a multiselect field?
Hi fellow zohoers,
Thanks to some help from a moderator here. the code I used below allowed me to insert rows in a different table given certain criteria: The decision box "All" had to have a value of "true" (if (input.All))- and the input.client id had to match the client id selected in my URLs table (in my SEO order tracking app, this script is executed in my Orders form and inserts rows in the Order Lines form for each URL a selected client has.
My question is: can I adapt the following code so that I can select clients from a multiselect lookup field, and then insert rows for each url for where the client id is selected in that field--as I have done for a single client selected from a dropdown so far? How would I go about doing this?
- if (count(URLs[Client_ID == input.Client_ID]) > 0)
- {
- AllUrls = URLs [Client_ID == input.Client_ID];
- if (input.All)
- {
- for each key in AllUrls
- {
- insert into Order_Lines
- [
- Added_User = zoho.loginuser
- Client_ID = key.Client_ID
- Client_Type = key.Client_Type
- Keywords = key.Keywords
- Line_Cost = (input.Order_Cost / count(URLs[Client_ID == input.Client_ID]))
- Month = zoho.currentdate.getMonth()
- Order_Number = input.Order_Number
- Total_Order_Cost = input.Order_Cost
- URL = key.URL
- Vendor = input.Vendor_ID
- Year = zoho.currentdate.getYear()
- ]
- }
- }
- }
Any help is truly appreciated...I'm extremely pleasantly surprised with just how customizable this system has been so far, thanks for everything.
Navid