<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.aras.com/community/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/f/development/3856/how-to-define-sequence-number-to-a-document-sub-type</link><description>I have a Design Document as sub item type of Document and would like to assign a different sequence number to the “Document Number” attribute and how to achieve this?</description><dc:language>ja-JP</dc:language><generator>Telligent Community 12</generator><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1885?ContentTypeID=1</link><pubDate>Fri, 03 Aug 2018 02:29:46 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:505a7d9b-fc11-46cd-b6b5-5ac412e589d3</guid><dc:creator>Former Member</dc:creator><description>Now I understand the concept.But I am looking for something to configure it rather writing code&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1884?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2018 13:31:02 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:7c3f073f-eb43-49b3-b6b8-3002a46fda08</guid><dc:creator>Meismart</dc:creator><description>Now you understand the concept, it is possible to automatically create and use the sequences.
(Note that you cannot create a sequence and call get next sequence in the same Method due to a clash creating and using the sequence)

Something similar to:

//sequence 1
Item seq1 = inn.newItem(&amp;quot;Sequence&amp;quot;,&amp;quot;get&amp;quot;);
seq1.setProperty(&amp;quot;name&amp;quot;,&amp;quot;mySequence_&amp;quot; + this.getProperty(&amp;quot;classification&amp;quot;,&amp;quot;default&amp;quot;));
seq1 = seq1.apply();

//if not found, add a new sequence
if(seq1.getItemCount()&amp;lt;1)
{
seq1 = inn.newItem(&amp;quot;Sequence&amp;quot;,&amp;quot;add&amp;quot;);
seq1.setProperty(&amp;quot;name&amp;quot;,&amp;quot;mySequence_&amp;quot; + this.getProperty(&amp;quot;classification&amp;quot;,&amp;quot;default&amp;quot;));
//update the following to match your requirements//
string pre = &amp;quot;pre&amp;quot;
seq1.setProperty(&amp;quot;prefix&amp;quot;,pre);
string suf = &amp;quot;suf&amp;quot;
seq1.setProperty(&amp;quot;suffix&amp;quot;,suf);
string curVal = &amp;quot;1&amp;quot;
seq1.setProperty(&amp;quot;current_value&amp;quot;,curVal );
string pad = &amp;quot;0&amp;quot;
seq1.setProperty(&amp;quot;pad_with&amp;quot;,pad);
int padto = 9
seq1.setProperty(&amp;quot;pad_to&amp;quot;,padto.ToString());
seq1.setProperty(&amp;quot;step&amp;quot;,&amp;quot;1&amp;quot;);
//end of update//
seq1 = seq1.apply();
//set the new sequence number on the part must match the new sequence above
string s = &amp;quot;&amp;quot;;
//adjust padto if using more than 1 digit in curVal
for (int i = 0; i&amp;lt;padto; i++)
{
s+=pad;
}
s = pre+s+curVal+suf
this.setProperty(&amp;quot;item_number&amp;quot;, s);
}
else
{
//if found, get the next sequence number
string s = inn.getNextSequence(seq1.getProperty(&amp;quot;name&amp;quot;,&amp;quot;&amp;quot;));
//set the new sequence number on the part
this.setProperty(&amp;quot;item_number&amp;quot;, s);
}&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1883?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2018 06:25:21 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f772a62a-f918-4b37-97ad-f6450b5e3c98</guid><dc:creator>Former Member</dc:creator><description>Innovator inn = this.getInnovator();

string type = this.getProperty(&amp;quot;classification&amp;quot;, &amp;quot;&amp;quot;);
this.setProperty(&amp;quot;item_number&amp;quot;, inn.getNextSequence(&amp;quot;Design Document&amp;quot;));

if (type != null &amp;amp;&amp;amp; type.Equals(&amp;quot;Design Document&amp;quot;)) {
this.setProperty(&amp;quot;item_number&amp;quot;, inn.getNextSequence(&amp;quot;Design Document&amp;quot;));
} else if (type != null &amp;amp;&amp;amp; type.Equals(&amp;quot;Engineering Document&amp;quot;)) {
this.setProperty(&amp;quot;item_number&amp;quot;, inn.getNextSequence(&amp;quot;Engineering Document&amp;quot;));
} else if (type != null &amp;amp;&amp;amp; type.Equals(&amp;quot;Specification Document&amp;quot;)) {
this.setProperty(&amp;quot;item_number&amp;quot;, inn.getNextSequence(&amp;quot;Specification Document&amp;quot;));
}
return this;

&amp;nbsp;

this is working and I made &amp;quot;item_number&amp;quot; attribute to string and removed required property.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1882?ContentTypeID=1</link><pubDate>Thu, 02 Aug 2018 05:34:52 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:fe7ecb51-ff1f-42f0-af15-98420b4e42ea</guid><dc:creator>Former Member</dc:creator><description>Yes I have the sequence created.Still I am getting the error&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1881?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 09:39:54 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:10b968f1-c974-4047-8d89-e44e51aaca4a</guid><dc:creator>Meismart</dc:creator><description>Q1) Have you created the sequences Design Document, Engineering Document, Specification Document?

Q2) Does your field &amp;quot;Document Number&amp;quot; actually refer to the property &amp;quot;item_number&amp;quot;? If so, try changing &amp;quot;Document Number&amp;quot; to &amp;quot;item_number&amp;quot;

If you do not wish to use code, you may be able to do something with xProperties, but I have not used these yet.

Many thanks
Martin.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1880?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 07:16:57 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:f874e72c-f819-45be-89dc-b258d08e6536</guid><dc:creator>Former Member</dc:creator><description>getting this error:

SOAP-ENV:Envelope&amp;gt;
-&amp;lt;SOAP-ENV:Body&amp;gt;
-&amp;lt;SOAP-ENV:Fault&amp;gt;
&amp;lt;faultcode&amp;gt;SOAP-ENV:Server&amp;lt;/faultcode&amp;gt;
&amp;lt;faultstring&amp;gt;&amp;#39;./Document Number&amp;#39; has an invalid token.&amp;lt;/faultstring&amp;gt;
-&amp;lt;detail&amp;gt;
&amp;lt;af:legacy_detail&amp;gt;&amp;#39;./Document Number&amp;#39; has an invalid token.&amp;lt;/af:legacy_detail&amp;gt;
&amp;lt;af:exception message =&amp;quot; &amp;#39;./Document Number&amp;#39; has an invalid token. &amp;quot; type =&amp;quot;System.Xml.XPath.XPathException &amp;quot; /&amp;gt;
&amp;lt;/detail&amp;gt;
&amp;lt;/SOAP-ENV:Fault&amp;gt;
&amp;lt;/SOAP-ENV:Body&amp;gt;
&amp;lt;/SOAP-ENV:Envelope&amp;gt;

&amp;nbsp;

code is :

Innovator inn = this.getInnovator();
if (this.getProperty(&amp;quot;classification&amp;quot;,&amp;quot;&amp;quot;) == &amp;quot;Design Document&amp;quot;)
{
this.setProperty(&amp;quot;Document Number&amp;quot;,inn.getNextSequence(&amp;quot;Design Document&amp;quot;));
}
else if (this.getProperty(&amp;quot;classification&amp;quot;,&amp;quot;&amp;quot;) == &amp;quot;Engineering Document&amp;quot;)
{
this.setProperty(&amp;quot;Document Number&amp;quot;,inn.getNextSequence(&amp;quot;Engineering Document&amp;quot;));
}
else if (this.getProperty(&amp;quot;classification&amp;quot;,&amp;quot;&amp;quot;) == &amp;quot;Specification Document&amp;quot;)
{
this.setProperty(&amp;quot;Document Number&amp;quot;,inn.getNextSequence(&amp;quot;Specification Document&amp;quot;));
}

return this;

&amp;nbsp;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1879?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 06:26:28 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:7ed781af-68d1-40ff-81b6-921392a80e7a</guid><dc:creator>Former Member</dc:creator><description>Thank you for the reply. Is it not possible change the property itself for different types? Like in the configuration page. I don&amp;#39;t like writing code against each type. I have created sequences for different types and want to edit the property &amp;quot;item_number&amp;quot; as sequence and select the sequence against each sub type. Is that possible?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO DEFINE SEQUENCE NUMBER TO A DOCUMENT SUB TYPE?</title><link>https://www.aras.com/community/thread/1878?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 05:54:47 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:1312770a-8951-4ed9-8463-73a2416c98b4</guid><dc:creator>Meismart</dc:creator><description>One way might be:

First set the &amp;quot;Document Number&amp;quot; Property to string, then you can use the onBeforeAdd event to call a method.

The Method should check for (this.classification == &amp;quot;SubType&amp;quot;) and  use getNextSequence(&amp;quot;&amp;quot;) to get the next number from your sequences.

Something like:

Innovator inn = this.getInnovator();
if (this.getProperty(&amp;quot;classification&amp;quot;,&amp;quot;&amp;quot;) == &amp;quot;SubClass&amp;quot;)
{
this.setProperty(&amp;quot;Document Number&amp;quot;,inn.getNextSequence(&amp;quot;mySequence_1&amp;quot;) )
}
else
{
this.setProperty(&amp;quot;Document Number&amp;quot;,inn.getNextSequence(&amp;quot;mySequence_2&amp;quot;) )
}
return this;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>