Insert multiple rows with creator...possible?
I'd like to know if what I am attempting is just impossible in zoho or if I'm doing something wrong...any feedback is appreciated!
So in my application- basically an SEO order tracking app- I have a table for Orders (where the below script is coming from) and a table for Order Lines- each record in this table is one line out of an order- each order has a unique number and I select the number in a lookup to attach each line to an order.
Some websites that I do seo for have many urls and keywords- entering them in line by line for an order would be tedious, so I wanted to come up with a way to automatically insert records into Order_Lines for all of the URLs for a given client.
First I fetched records from the URL table where the client matches the client I select for the order.
I only want to do this automatic row creation in some cases, not always, so then I made a decision field called All and started the statement with if all = true
Then I set up the for each loop and the command to insert rows into order lines, with all the fields filled with necessary expressions and values- the syntax doesn't trigger any errors but I get no results. Any idea what I'm doing wrong here?
- 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[key.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()
- ]
- }
- }
- }