Fusion Manage Forum
Welcome to Autodesk’s Fusion Manage (formerly Fusion 360 Manage) Forum. Share your knowledge, ask questions, and explore popular Fusion Manage topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Script Time Limit Exception

4 REPLIES 4
Reply
Message 1 of 5
dkeeley
393 Views, 4 Replies

Script Time Limit Exception

Hi,

 

I have developed a script to update the derived fields on some records I have imported (there is currently a bug where derived fields do not resolve during import - they only reolve when the item is edited). The problem is that I have over 5000 import records to modify (dmsID 50575 to 55716).

 

The script below works (I use the workspace 'create' behaviour to call it). However when I try to run it for more then 200 or so records I get a 'ScriptTimeLimitException' error (see attached). Please advise.

 

The scirpt is:

 

//This script resolves derived fields. Required because serived fields do not resolve during import.

record = 50575;

do{
    var newItem = loadItem(record);
    if (newItem.CONTRACT_NUMBER4 != null){
        var linked_item = newItem.CONTRACT_NUMBER4;
        if (linked_item.CUSTOMER != null){
            newItem.CUSTOMER4 = linked_item.CUSTOMER;
        }
        if (linked_item.DETAILS != null){
            newItem.DESCRIPTION2 = linked_item.DETAILS;
        }
    }
    record++;
}while(record <55717);

Tags (2)
4 REPLIES 4
Message 2 of 5
broepke
in reply to: dkeeley

Scott,

 

Clever 🙂  That's a system limitation so we don't have "run away" scripts.  Think of cases where stuff is just so intensive that it actually affects the performance of your site, etc...  It's set to 500 ms.

 

So - What you can do is break it down in chuncks.  Try processing 1/2 of them first.  Then edit the script and do the other 1/2.  That doesn't fly do 1/3 or whatever.

 

(or chunks of 1000? I have no clue how many it can do... It will take some experimenting.



Brian Roepke
Director, Analytics & Insights
Message 3 of 5
dkeeley
in reply to: broepke

Hi Scott,

 

I can only seem to get it to run for about 200 records at a time. Is there nay way to make the code more efficient as you see it? (i'm not a software person BTW) 😉

 

Thanks,

 

David.

Message 4 of 5
dkeeley
in reply to: dkeeley

Sorry. Brian - not Scott.

Message 5 of 5
jared.sund
in reply to: dkeeley

I don't see any obvious performance issues with your script, however you may be able to gain some performance using a multi-pick list and not the loadItem function.  This approach might take a couple of temp workspaces to get through the process, but could increase your chunk size. 

Jared Sund
Sr. Product Line Manager, Product Lifecycle Management
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report