{"id":77602,"date":"2024-07-04T11:28:35","date_gmt":"2024-07-04T10:28:35","guid":{"rendered":"https:\/\/arquiconsult.com\/?p=77602"},"modified":"2024-10-23T11:30:20","modified_gmt":"2024-10-23T10:30:20","slug":"bc-number-sequence-data-type","status":"publish","type":"post","link":"https:\/\/arquiconsult.com\/en\/bc-number-sequence-data-type\/","title":{"rendered":"#055 BC NUMBER SEQUENCE DATA TYPE"},"content":{"rendered":"<div class=\"services_vertical horizontal_services row\" style=\"background-color: #f7f7f7; padding: 25px; border-radius: 5px; text-align: justify;\">\n<p><strong>NumberSequence<\/strong> is a new Business Central Data Type for creating and managing number sequences in the database.<\/p>\n<p>They are built on SQL Server sequences, meaning that they are not associated with any tables. The numbers in a number sequence are generated in ascending order at a defined interval but can be skipped.<\/p>\n<p>In some cases, the use of NumberSequence may constitute an advantage over No. Series, as it allows to implement non-continuous and non-blocking numbering with simplicity.<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<p>The following methods are available on the NumberSequence data type:<\/p>\n<ul>\n<li>Insert(Text [, BigInteger] [, BigInteger] [, Boolean]) \u2013 Creates the number sequence<\/li>\n<li>Exists(Text [, Boolean]) \u2013 Checks the existence of a specific number sequence<\/li>\n<li>Delete(Text [, Boolean]) \u2013 Deletes a specific number sequence<\/li>\n<li>Current(Text [,Boolean]) \u2013 Gets the current value from the number sequence<\/li>\n<li>Next(Text [, Boolean]) \u2013 Gets the next value from the number sequence and increments its value<\/li>\n<li>Range(Text, Integer, var BigInteger [, Boolean]) \u2013 Retrieves a range of values from the number sequence<\/li>\n<li>Restart(Text [, BigInteger] [, Boolean]) \u2013 Restarts the number sequence<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>Example<\/strong><\/p>\n<p>Scenario: Imagine that for every newly created <em>Customer Bank Account<\/em> associated with a <em>Customer<\/em> (with Customer No. \u2018CUST1\u2019), it is necessary to have an identifier that represents the order of creation.<\/p>\n<p>&nbsp;<\/p>\n<p>Firstly, the NumberSequence is initialized in the insertion of the <em>Customer<\/em>.<\/p>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-77606 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer.-640x125.png\" alt=\"-\" width=\"640\" height=\"125\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer.-640x125.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer.-768x150.png 768w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer.-320x63.png 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer.-480x94.png 480w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer.-800x157.png 800w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Firstly-the-NumberSequence-is-initialized-in-the-insertion-of-the-Customer..png 1032w\" sizes=\"(max-width: 640px) 100vw, 640px\" title=\"-\"><\/p>\n<p>Then, every time that a <em>Customer Bank Account <\/em>is created for customer \u2018CUST1\u2019<em>, <\/em>the next value from the number sequence is retrieved and attributed to the field OrderOfCreation.<\/p>\n<p><img loading=\"lazy\" class=\"size-medium wp-image-77609 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Then-every-time-that-a-Customer-Bank-Account-is-created-for-customer-\u2018CUST1-the-next-value-from-the-number-sequence-is-retrieved-and-attributed-to-the-field-OrderOfCreation.-640x131.png\" alt=\"-\" width=\"640\" height=\"131\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Then-every-time-that-a-Customer-Bank-Account-is-created-for-customer-\u2018CUST1-the-next-value-from-the-number-sequence-is-retrieved-and-attributed-to-the-field-OrderOfCreation.-640x131.png 640w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Then-every-time-that-a-Customer-Bank-Account-is-created-for-customer-\u2018CUST1-the-next-value-from-the-number-sequence-is-retrieved-and-attributed-to-the-field-OrderOfCreation.-320x66.png 320w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Then-every-time-that-a-Customer-Bank-Account-is-created-for-customer-\u2018CUST1-the-next-value-from-the-number-sequence-is-retrieved-and-attributed-to-the-field-OrderOfCreation.-480x98.png 480w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Then-every-time-that-a-Customer-Bank-Account-is-created-for-customer-\u2018CUST1-the-next-value-from-the-number-sequence-is-retrieved-and-attributed-to-the-field-OrderOfCreation..png 692w\" sizes=\"(max-width: 640px) 100vw, 640px\" title=\"-\"><\/p>\n<p>Finally, if the <em>Customer<\/em> is deleted, the associated NumberSequence should be deleted alongside it.<\/p>\n<p><img loading=\"lazy\" class=\"size-full wp-image-77613 aligncenter\" src=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Finally-if-the-Customer-is-deleted-the-associated-NumberSequence-should-be-deleted-alongside-it..png\" alt=\"-\" width=\"399\" height=\"123\" srcset=\"https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Finally-if-the-Customer-is-deleted-the-associated-NumberSequence-should-be-deleted-alongside-it..png 399w, https:\/\/arquiconsult.com\/wp-content\/uploads\/2024\/09\/Finally-if-the-Customer-is-deleted-the-associated-NumberSequence-should-be-deleted-alongside-it.-320x99.png 320w\" sizes=\"(max-width: 399px) 100vw, 399px\" title=\"-\"><\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-77602\" data-postid=\"77602\" class=\"themify_builder_content themify_builder_content-77602 themify_builder tf_clear\">\n    \t<!-- module_row -->\n\t<div  data-lazy=\"1\" class=\"module_row themify_builder_row tb_nus1581 tb_first tf_clearfix\">\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_cai8581 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module text -->\n<div  class=\"module module-text tb_9tkr581 arquitps-data  \" data-lazy=\"1\">\n        <div  class=\"tb_text_wrap\">\n    <p><script>\njQuery(\".tbp_post_month:contains(Janeiro)\").html(\"January\");\n\njQuery(\".tbp_post_month:contains(Fevereiro)\").html(\"February\");\n\n\njQuery(\".tbp_post_month:contains(Mar\u00e7o)\").html(\"March\");\n\n\njQuery(\".tbp_post_month:contains(Abril)\").html(\"April\");\n\n\njQuery(\".tbp_post_month:contains(Maio)\").html(\"May\");\n\n\njQuery(\".tbp_post_month:contains(Junho)\").html(\"June\");\n\n\njQuery(\".tbp_post_month:contains(Julho)\").html(\"July\");\n\njQuery(\".tbp_post_month:contains(Agosto)\").html(\"August\");\n\njQuery(\".tbp_post_month:contains(Setembro)\").html(\"September\");\n\njQuery(\".tbp_post_month:contains(Outubro)\").html(\"October\");\n\njQuery(\".tbp_post_month:contains(Novembro)\").html(\"November\");\n\njQuery(\".tbp_post_month:contains(Dezembro)\").html(\"December\");\t\n\n\n\n<\/script><\/p>    <\/div>\n<\/div>\n<!-- \/module text -->\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t\t<!-- module_row -->\n\t<div  data-anchor=\"sucesso\" data-hide-anchor=\"1\" data-lazy=\"1\" class=\"module_row themify_builder_row sucesso repeat tb_has_section tb_section-sucesso tb_0jtb241 tf_clearfix\" >\n\t    \t\t<div class=\"row_inner col_align_top col-count-1 tf_box tf_w tf_rel\">\n\t\t\t<div  data-lazy=\"1\" class=\"module_column tb-column col-full first tb_nf7j241 tf_box\">\n\t\t\t    \t        <div class=\"tb-column-inner tf_box tf_w\">\n\t\t    <!-- module buttons -->\n<div  class=\"module module-buttons tb_d48f242 buttons-horizontal transparent popmake-24705 large circle tf_textc\" data-lazy=\"1\">\n    \t<div class=\"module-buttons-item tf_inline_b\">\n\t\t\t\t\t\t\t<a href=\"#\" class=\"ui builder_button tb_default_color\" >\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"tf_inline_b tf_vmiddle\">Give as a Feedback and Suggest Questions<\/span>\n\t\t\t\t\t\t\t\t\t\t\t<\/a>\n\t\t\t    \t<\/div>\n\t<\/div>\n<!-- \/module buttons -->\n\t        <\/div>\n\t    \t<\/div>\n\t\t    <\/div>\n\t    <!-- \/row_inner -->\n\t<\/div>\n\t<!-- \/module_row -->\n\t<\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>NumberSequence is a new Business Central Data Type for creating and managing number sequences in the database. They are built on SQL Server sequences, meaning that they are not associated with any tables. The numbers in a number sequence are generated in ascending order at a defined interval but can be skipped. In some cases, [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":77618,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2099,2124],"tags":[1339,2015,2588],"acf":[],"_links":{"self":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/posts\/77602"}],"collection":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/comments?post=77602"}],"version-history":[{"count":0,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/posts\/77602\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/media\/77618"}],"wp:attachment":[{"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/media?parent=77602"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/categories?post=77602"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arquiconsult.com\/en\/wp-json\/wp\/v2\/tags?post=77602"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}