This topic contains 7 replies, has 0 voices, and was last updated by j.j 8 years, 3 months ago.
-
AuthorPosts
-
August 11, 2016 at 2:32 pm #6218
MarkZSSIAre there any tips on how to optimize the code where there are a lot of searches and submit records that would cause you to blow through the governance limits that NS sets? I thought about shoving all the results into an array in the loop and doing the submit after the loop, but that doesn’t seem to work at all.
Any other ways to do this?
This is a cached copy. Click here to see the original post. -
August 11, 2016 at 3:27 pm #6219
david.smithI do the seach(s) and stick what I need into an object. From there I will parse out the data. I very rarely use an array because that just causes to many loops. I think you’re on the right track. Best practice would be to never have a search/lookup in a loop if you can avoid it.
-
August 11, 2016 at 3:36 pm #6220
MarkZSSIOriginally posted by david.smith
View Post
I do the seach(s) and stick what I need into an object. From there I will parse out the data. I very rarely use an array because that just causes to many loops. I think you’re on the right track. Best practice would be to never have a search/lookup in a loop if you can avoid it.
Thanks for the response. I think I’ll give that a try tomorrow.
-
August 12, 2016 at 5:07 am #6221
NelliottIf it’s something you can schedule you might also consider a mass update script.
Not sure if this would meet your needs but I thought I’d throw it out there for you to consider.
-
August 12, 2016 at 12:13 pm #6222
MarkZSSIOriginally posted by Nelliott
View Post
If it’s something you can schedule you might also consider a mass update script.
Not sure if this would meet your needs but I thought I’d throw it out there for you to consider.
Any reason you would say that?
-
August 16, 2016 at 2:44 am #6223
NelliottOriginally posted by MarkZSSI
View Post
Any reason you would say that?
The governance on a mass update is such that you’re extremely unlikely to run out of governance. It’s allocated on a per record basis.
From the NS Help : “The SuiteScript governance limit is 1000 units per record/ invocation of a mass update script.”
-
August 17, 2016 at 12:15 am #6224
CREECEThe best thing to do is get ALL data that is needed into some object and then act on said data. You can utilize the nlapiYield function that will preserve your running logic for a subsequent governance set. Without seeing what else you are doing, it is hard to say what you can do for optimization.
-
August 17, 2016 at 12:57 am #6225
j.jit all depends on the volumes and the exact need. i had tremendous amount of data crunching needed and that meant re-running/re-scheduling the script due to governance limits, the best i could work out was to create a temp file and store data in it, re-read process re-write till the entire set of operations is completed. hope this helps
-
AuthorPosts
You must be logged in to reply to this topic.