<?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>Property Setting Sequence</title><link>https://www.aras.com/community/f/development/6098/property-setting-sequence</link><description>Hi 
 Item property _aaa I setting sequence prefix=A- like A-0001, but I need _aaa can get another sequence prefix=B- like B-0001 
 Can I onBeforeAdd write when (my logic) get sequence A-XXX or get sequence B-XXX?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Property Setting Sequence</title><link>https://www.aras.com/community/thread/3138?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 12:58:28 GMT</pubDate><guid isPermaLink="false">916d3f7e-8ddc-42f8-8d45-380822f51406:dcd26fca-f8a7-402c-bc17-bbc45f492150</guid><dc:creator>cogres</dc:creator><description>&lt;p&gt;Hi Michelle,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think you can set the property&amp;#39;s data type as &amp;quot;Sequence&amp;quot; and then &amp;#39;dynamically&amp;#39; decide, item per item, which sequence to use.&lt;/p&gt;
&lt;p&gt;What you could do is set the property&amp;#39;s data type as &amp;quot;String&amp;quot; or &amp;quot;Text&amp;quot; and prevent the user from setting or changing it themselves (by disabling the field in the item form and - if you need more control - in some onBeforeUpdate method or some such). Then - as you yourself suggested - you can implement an onBeforeAdd method that gets the right value from the right sequence using the handy &lt;span&gt;getNextSequence(System.String) in the Innovator class&lt;/span&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Say we have two sequences with names &amp;quot;sequence_a&amp;quot; and &amp;quot;sequence_b&amp;quot; that correspond to your sequences with prefixes &amp;quot;A-&amp;quot; and &amp;quot;B-&amp;quot;, respectively. Also assume that earlier in the method, you ran some business logic to determine which sequence to use and this information is represented by the&amp;nbsp;bool useSequenceA. You could then have something like the following:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;// Some business logic to assign bool useSequenceA&lt;br /&gt;Innovator inn = this.getInnovator();&lt;br /&gt;string currentValue = inn.getNextSequence(useSequenceA ? &amp;quot;sequence_a&amp;quot; : &amp;quot;sequence_b&amp;quot;);&lt;br /&gt;this.setProperty(&amp;quot;dynamic_sequence_prop&amp;quot;, currentValue);&lt;br /&gt;&lt;br /&gt;return this;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p&gt;Note that, conveniently, getNextSequence() not only returns the current_value of the sequence, but also increments it by that sequence&amp;#39;s &amp;#39;step&amp;#39; on the sequence item. So you do not have to worry about doing that manually.&lt;/p&gt;
&lt;p&gt;I hope this helps a litte.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;C&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>