• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk PLM 360

    Reply
    *Expert Elite*
    ScottMoyse
    Posts: 1,278
    Registered: ‎06-10-2009

    Nice scripting error for you guys

    80 Views, 7 Replies
    10-04-2012 12:27 PM

    On creating an Item I got the following scriting error:

    Capture.PNG

    Since it made no sense to me & didn't appear to point to anything wrong with my script, i decided to try & create the item again. It worked... But its the longest 'scripting' error I've seen so far so I thought I'd share my landmark moment. :smileyhappy:

    Cheers
    Scott Moyse

    Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Cheers!


       

    Please use plain text.
    Product Support
    Posts: 170
    Registered: ‎03-27-2012

    Re: Nice scripting error for you guys

    10-04-2012 12:31 PM in reply to: ScottMoyse

    Hi Scott,

     

    Mind posting the script(s) you were using JAVA and computed fields.



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

    Please use plain text.
    *Expert Elite*
    ScottMoyse
    Posts: 1,278
    Registered: ‎06-10-2009

    Re: Nice scripting error for you guys

    10-04-2012 12:47 PM in reply to: piggeej

    /*
    item.NUMBER = item.PROJECT.CONTRACT_NUMBER + "-" + item.DECK + "-" + item.AREA;

     

    if (item.AREA <= 9)
    {item.WORK_PACK_NUMBER = item.DECK + "0" + item.AREA;}
    else
    {item.WORK_PACK_NUMBER = item.DECK + item.AREA;}

    */

    //=========== sets the related product's Work Allocations ======================//

    setLists();

    //=========== sets the current Items Number ======================//

    item.NUMBER = item.RELATED.CONTRACT_NUMBER + "-" + item.DECK + "-" + item.AREA;

    if (item.AREA <= 9)
    {item.WORK_PACK_NUMBER = item.DECK + "0" + item.AREA;}
    else
    {item.WORK_PACK_NUMBER = item.DECK + item.AREA;}

    Cheers
    Scott Moyse

    Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Cheers!


       

    Please use plain text.
    *Expert Elite*
    ScottMoyse
    Posts: 1,278
    Registered: ‎06-10-2009

    Re: Nice scripting error for you guys

    10-04-2012 12:48 PM in reply to: ScottMoyse

    setlists:

     

    function setLists(){

    var desc = item.descriptor.descriptor;
    var tempProduct = null;

    if(item.RELATED_TEMP === null){
    item.RELATED_TEMP = item.RELATED.descriptor.descriptor;
    }
    else if (item.RELATED === null && item.RELATED_TEMP !== null){
    tempProduct = new parentObject(item.RELATED_TEMP.descriptor.dmsID);
    tempProduct.removeItem(desc);
    item.RELATED_TEMP = null;
    }
    else if(item.RELATED.descriptor.descriptor !== item.RELATED_TEMP.descriptor.descriptor){
    tempProduct = new parentObject(item.RELATED_TEMP.descriptor.dmsID);
    tempProduct.removeItem(desc);

    //item.RELATED_TEMP.RELATED_WORK_ALLOCATIONS = removeItem(item.RELATED_TEMP.RELATED_WORK_ALLOCATIONS, item.descriptor.descriptor);
    item.RELATED_TEMP = item.RELATED.descriptor.descriptor;
    }//end if



    if(item.RELATED !== null){

    var product = new parentObject(item.RELATED.descriptor.dmsID);
    product.addItem(desc);

    }//end if
    }

     

    function parentObject(dmsID){
    this.myObject = loadItem(dmsID);

    this.addItem = function(descriptor){
    if(this.itemExists(descriptor) === false){
    var currentValues = this.returnItems(descriptor);
    currentValues.push(descriptor);
    this.myObject.RELATED_ITEMS = currentValues;
    }
    };

    this.itemExists = function(descriptor){
    if(this.myObject.RELATED_ITEMS === null){return false;}
    for (var i = 0; i < this.myObject.RELATED_ITEMS.length; i++) {
    if(descriptor === this.myObject.RELATED_ITEMS[i].descriptor.descriptor){
    return true;
    }
    }
    return false;
    };

    this.returnItems = function(){
    var currentValues = [];
    if(this.myObject.RELATED_ITEMS === null){return currentValues;}
    for (var i = 0; i < this.myObject.RELATED_ITEMS.length; i++) {
    currentValues.push(this.myObject.RELATED_ITEMS[i].descriptor.descriptor);
    }
    return currentValues;
    };

    this.removeItem = function(descriptor){
    var currentValues = [];
    for (var i = 0; i < this.myObject.RELATED_ITEMS.length; i++) {
    if(descriptor !== this.myObject.RELATED_ITEMS[i].descriptor.descriptor){
    currentValues.push(this.myObject.RELATED_ITEMS[i].descriptor.descriptor);
    }
    }

    this.myObject.RELATED_ITEMS = currentValues;

    };
    }

    Cheers
    Scott Moyse

    Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Cheers!


       

    Please use plain text.
    *Expert Elite*
    ScottMoyse
    Posts: 1,278
    Registered: ‎06-10-2009

    Re: Nice scripting error for you guys

    10-04-2012 12:51 PM in reply to: ScottMoyse

    There's one computed field in the item details:

     

    BUDGET_HOURS-HOURS_TO_DATE

     

    Cheers
    Scott Moyse

    Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Cheers!


       

    Please use plain text.
    Product Support
    michelle.stone
    Posts: 165
    Registered: ‎02-21-2012

    Re: Nice scripting error for you guys

    10-04-2012 01:14 PM in reply to: ScottMoyse

    Scott - I just came across pretty much the same error in another tenant.  Will report.

     

    And same as you - retrying worked.

     

    Michelle



    Michelle Stone
    PLM Product Manager
    Autodesk, Inc.
    Please use plain text.
    Product Support
    Posts: 170
    Registered: ‎03-27-2012

    Re: Nice scripting error for you guys

    10-04-2012 01:21 PM in reply to: ScottMoyse

    Scott,

     

    Looks like an issue with stamping userids to the logging section on item creation, checking with the powers to be right now.



    Joe Piggee
    Support Specialist
    Product Support
    Autodesk, Inc.

    Please use plain text.
    *Expert Elite*
    ScottMoyse
    Posts: 1,278
    Registered: ‎06-10-2009

    Re: Nice scripting error for you guys

    10-04-2012 01:31 PM in reply to: piggeej

    sweet :-) glad i reported it then

    Cheers
    Scott Moyse

    Please use Mark Solutions!.Accept as Solution &Give Kudos!Kudos to further enhance the value of these forums. Cheers!


       

    Please use plain text.