<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Scripting operations in arrays in Fusion Manage Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6908812#M3702</link>
    <description>Hi Stuart,&lt;BR /&gt;You could use multiselect picklist for both to:: and has:: arrays and manipulate those. Alternatively, can use a reference to a new 'virtual user group' workspace where each item had multiselect plm with preselect users representing a more or less fixed approver group. The approving item would have a single select picklist pointing to the group item. This wont give you granularity to change the group but can still track has:: and to::: approve in separate lists quiering the linked picklist. HTH,</description>
    <pubDate>Tue, 28 Feb 2017 12:38:35 GMT</pubDate>
    <dc:creator>gasevsm</dc:creator>
    <dc:date>2017-02-28T12:38:35Z</dc:date>
    <item>
      <title>Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6908786#M3701</link>
      <description>&lt;P&gt;Yo guys, I'm rewriting a condition script that we have which has been timing out regularly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, the condition script dynamically builds an array of users who have performed a particular transition in the workflow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to create a physical array on the item details page, that can be used as above (but moving the time required to build the arrays into an action script)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I have in mind is two arrays, "to approve" and "has approved". The condition script then simply looks at the "to aprove" array, and allows multiple transitions to these users. When they perform a transition, I want the action script to remove their name from the first array, and move it to the second.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to use Array.slice() for this purpose, however I keep getting errors in the script tool. "&lt;SPAN&gt;Cannot find function slice in object"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;PRE&gt;var usr = Security.loadUser(userID);
var usrName = usr.lastName+", "+usr.firstName;

var toApprove = item.ORIGINAL_APPROVERS;
var hasApproved = item.APPROVED_BY;

    for (var user in toApprove){
        var toApproveMember = toApprove[user];
    	if (toApproveMember === usrName) {
        hasApproved.add(toApprove[user]);
        toApprove.remove(toApprove[user]);
        break;
    	}
    }
 //   println(typeof(toApprove));
 //  var ABCDEFG = toApprove.slice(user,1);
 //  println(ABCDEFG);&lt;/PRE&gt;&lt;P&gt;Using .add and .remove has allowed me to move the names around the arrays, but the limitation here is that I can't read the length of "toApprove", to determine when there is only 1 approver remaining (who pushes down a different transition from the others).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any Suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 12:30:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6908786#M3701</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-28T12:30:27Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6908812#M3702</link>
      <description>Hi Stuart,&lt;BR /&gt;You could use multiselect picklist for both to:: and has:: arrays and manipulate those. Alternatively, can use a reference to a new 'virtual user group' workspace where each item had multiselect plm with preselect users representing a more or less fixed approver group. The approving item would have a single select picklist pointing to the group item. This wont give you granularity to change the group but can still track has:: and to::: approve in separate lists quiering the linked picklist. HTH,</description>
      <pubDate>Tue, 28 Feb 2017 12:38:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6908812#M3702</guid>
      <dc:creator>gasevsm</dc:creator>
      <dc:date>2017-02-28T12:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909059#M3703</link>
      <description>&lt;P&gt;Hi Martin and thanks for the super-quick response!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both my' to..' and 'has..' fields are set as multi-select picklists (specifically, the built-in "Users, all" picklist). I'm wondering whether these field types&amp;nbsp;&lt;EM&gt;act and look&lt;/EM&gt; like array objects, but are in actual fact something else? This would explain why I can't get Array.splice() to work on them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll suggest the groups idea to our PLM team, although as this is our supplier enquiry workspace nearly every employee will review a supplier quote at some point and so we need to retain the ability to select specific users per record.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 14:06:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909059#M3703</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-28T14:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909508#M3704</link>
      <description>Yes they are FLC arrays but not JS arrays, hence splice() limitation. Let me see what i find on my side.</description>
      <pubDate>Tue, 28 Feb 2017 16:00:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909508#M3704</guid>
      <dc:creator>gasevsm</dc:creator>
      <dc:date>2017-02-28T16:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909540#M3705</link>
      <description>&lt;P&gt;Cool, thanks Martin.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get around it other ways, for example I can compare the array length of the approved users to the original. It will mean the code has an extra line to compare the values, but I can't imagine it'll add any noticeable time on. I'll report back once I'm done,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 16:11:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909540#M3705</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-02-28T16:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909742#M3706</link>
      <description>&lt;A href="http://help.autodesk.com/view/PLM/ENU/?guid=GUID-BBBBAB3B-FEAE-4EB7-8D1B-29E76EC6BC65" target="_blank"&gt;http://help.autodesk.com/view/PLM/ENU/?guid=GUID-BBBBAB3B-FEAE-4EB7-8D1B-29E76EC6BC65&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;*         To add individual items, use item.LINKING_MULTISELECT.add(someItem)&lt;BR /&gt;&lt;BR /&gt;*         To remove individual items, use item.LINKING_MULTISELECT.remove(someItem)&lt;BR /&gt;&lt;BR /&gt;*         To clear the array, use item.LINKING_MULTISELECT.clear()</description>
      <pubDate>Tue, 28 Feb 2017 17:11:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909742#M3706</guid>
      <dc:creator>gasevsm</dc:creator>
      <dc:date>2017-02-28T17:11:48Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting operations in arrays</title>
      <link>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909744#M3707</link>
      <description>&lt;P&gt;Hey Stuart,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of:&lt;/P&gt;
&lt;PRE&gt; //   println(typeof(toApprove));
 //  var ABCDEFG = toApprove.slice(user,1);
 //  println(ABCDEFG);&lt;/PRE&gt;
&lt;P&gt;What about converting that object into an array with this, so you can use the Array methods?:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var convertedToApproveArr = Object.keys(toApprove).map(function (key) {
     return toApprove[key];
});

println(convertedToApproveArr);
var ABCDEFG = arr.slice(user,1);
println(ABCDEFG);&lt;/PRE&gt;
&lt;P&gt;Let us know how it goes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Giliar&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 17:13:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-manage-forum/scripting-operations-in-arrays/m-p/6909744#M3707</guid>
      <dc:creator>giliar.defriesperez</dc:creator>
      <dc:date>2017-02-28T17:13:07Z</dc:date>
    </item>
  </channel>
</rss>

