320 lines
No EOL
42 KiB
HTML
320 lines
No EOL
42 KiB
HTML
<!doctype html><html lang=en class="js csstransforms3d">
|
|
<head>
|
|
<meta charset=utf-8>
|
|
<meta name=viewport content="width=device-width,initial-scale=1">
|
|
<meta name=generator content="Hugo 0.89.2">
|
|
<meta name=description content>
|
|
<title>Surrogate keys using Autoincrement Pattern :: BC AL Help</title>
|
|
<link href=/css/nucleus.css?1636530359 rel=stylesheet>
|
|
<link href=/css/fontawesome-all.min.css?1636530359 rel=stylesheet>
|
|
<link href=/css/featherlight.min.css?1636530359 rel=stylesheet>
|
|
<link href=/css/perfect-scrollbar.min.css?1636530359 rel=stylesheet>
|
|
<link href=/css/auto-complete.css?1636530359 rel=stylesheet>
|
|
<link href=/css/theme.css?1636530359 rel=stylesheet>
|
|
<link href=/css/theme-blue.css?1636530359 rel=stylesheet>
|
|
<link href=/css/variant.css?1636530359 rel=stylesheet>
|
|
<link href=/css/print.css?1636530359 rel=stylesheet media=print>
|
|
<script src=/js/jquery.min.js?1636530359></script>
|
|
<style>:root #header+#content>#left>#rlblock_left{display:none!important}</style>
|
|
</head>
|
|
<body data-url=/navpatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/>
|
|
<script>var index_url="/index.json",root_url="/",baseUri=root_url.replace(/\/$/,'')</script>
|
|
<nav id=sidebar>
|
|
<div id=header-wrapper>
|
|
<div id=header>
|
|
<a id=logo href=/ style="color:#f5f5f5;font-family:novacento sans wide,helvetica,tahoma,geneva,arial,sans-serif;font-size:30px;font-weight:700;margin-top:-2px">
|
|
BC AL Help . dev
|
|
</a>
|
|
<i style=color:#f5f5f5>Code is Poetry</i>
|
|
</div>
|
|
<div class=searchbox>
|
|
<label for=search-by><i class="fas fa-search"></i></label>
|
|
<input data-search-input id=search-by type=search placeholder=Search...>
|
|
<span data-search-clear><i class="fas fa-times"></i></span>
|
|
</div>
|
|
<script src=/js/lunr.min.js?1636530359></script>
|
|
<script src=/js/auto-complete.js?1636530359></script>
|
|
<script src=/js/search.js?1636530359></script>
|
|
</div>
|
|
<div class=highlightable>
|
|
<ul class=topics>
|
|
<li data-nav-id=/welcome/ title=Welcome class=dd-item><a href=/welcome/><b><i class="fas fa-home"></i> </b>Welcome</a><ul></ul></li>
|
|
<li data-nav-id=/bcpatterns/ title="BC Patterns" class=dd-item><a href=/bcpatterns/><b><i class="fas fa-clone"></i> </b>BC Patterns</a><ul></ul></li>
|
|
<li data-nav-id=/bcbestpractices/ title="BC Dev. Best Practices" class=dd-item><a href=/bcbestpractices/><b><i class="fas fa-medal"></i> </b>BC Dev. Best Practices</a><ul></ul></li>
|
|
<li data-nav-id=/navpatterns/ title="NAV Patterns Archive" class="dd-item parent"><a href=/navpatterns/><b><i class="fas fa-save"></i> </b>NAV Patterns Archive</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/ title="1. Patterns" class="dd-item parent"><a href=/navpatterns/1-patterns/>1. Patterns</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/activity-log/ title="Activity Logs" class=dd-item><a href=/navpatterns/1-patterns/activity-log/>Activity Logs</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/argument-table/ title="Argument Table" class=dd-item><a href=/navpatterns/1-patterns/argument-table/>Argument Table</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/blocked-entity/ title="Blocked Entity" class=dd-item><a href=/navpatterns/1-patterns/blocked-entity/>Blocked Entity</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/blocked-entity/data-driven-blocked-entity/ title="Data Driven Blocked Entity" class=dd-item><a href=/navpatterns/1-patterns/blocked-entity/data-driven-blocked-entity/>Data Driven Blocked Entity</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/cached-web-service-calls/ title="Cached Web Server Calls" class=dd-item><a href=/navpatterns/1-patterns/cached-web-service-calls/>Cached Web Server Calls</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/conditional-cascading-update/ title="Conditional Cascading Update" class=dd-item><a href=/navpatterns/1-patterns/conditional-cascading-update/>Conditional Cascading Update</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/copy-document/ title="Copy Document" class=dd-item><a href=/navpatterns/1-patterns/copy-document/>Copy Document</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/create-data-from-templates/ title="Create Data from Templates" class=dd-item><a href=/navpatterns/1-patterns/create-data-from-templates/>Create Data from Templates</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/create-urls-to-nav-clients/ title="Create URLs to NAV Clients" class=dd-item><a href=/navpatterns/1-patterns/create-urls-to-nav-clients/>Create URLs to NAV Clients</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/creating-custom-charts/ title="Creating Custom Charts" class=dd-item><a href=/navpatterns/1-patterns/creating-custom-charts/>Creating Custom Charts</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/cross-session-events/ title="Cross Session Events" class=dd-item><a href=/navpatterns/1-patterns/cross-session-events/>Cross Session Events</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/currently-active-record/ title="Currently Active Record" class=dd-item><a href=/navpatterns/1-patterns/currently-active-record/>Currently Active Record</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/data-migration-facade/ title="Data Migration Facade" class=dd-item><a href=/navpatterns/1-patterns/data-migration-facade/>Data Migration Facade</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/discovery-event/ title="Discovery Event" class=dd-item><a href=/navpatterns/1-patterns/discovery-event/>Discovery Event</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/document/ title=Document class=dd-item><a href=/navpatterns/1-patterns/document/>Document</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/easy-update-of-setup-or-supplementary-information/ title="Easy Update Of Setup Or Supplementary Information" class=dd-item><a href=/navpatterns/1-patterns/easy-update-of-setup-or-supplementary-information/>Easy Update Of Setup Or Supplementary Information</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/error-message-processing/ title="Error Message Processing" class=dd-item><a href=/navpatterns/1-patterns/error-message-processing/>Error Message Processing</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/extending-the-role-center-headlines/ title="Extending the Role Center Headlines" class=dd-item><a href=/navpatterns/1-patterns/extending-the-role-center-headlines/>Extending the Role Center Headlines</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/feature-localization-for-data-structures/ title="Feature Localization For Data Structures" class=dd-item><a href=/navpatterns/1-patterns/feature-localization-for-data-structures/>Feature Localization For Data Structures</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/hooks/ title=Hooks class=dd-item><a href=/navpatterns/1-patterns/hooks/>Hooks</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/ title="Surrogate keys using Autoincrement Pattern" class="dd-item active"><a href=/navpatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/>Surrogate keys using Autoincrement Pattern</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/instructions-in-the-ui/ title="Instructions in the UI" class=dd-item><a href=/navpatterns/1-patterns/instructions-in-the-ui/>Instructions in the UI</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/integration-of-addresses/ title="Integration of Addresses" class=dd-item><a href=/navpatterns/1-patterns/integration-of-addresses/>Integration of Addresses</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/journal-error-processing/ title="Journal Error Processing" class=dd-item><a href=/navpatterns/1-patterns/journal-error-processing/>Journal Error Processing</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/journal-template-batch-line/ title="Journal Template Batch Line" class=dd-item><a href=/navpatterns/1-patterns/journal-template-batch-line/>Journal Template Batch Line</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/master-data/ title="Master Data" class=dd-item><a href=/navpatterns/1-patterns/master-data/>Master Data</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/multi-file-download/ title="Multi-file Download" class=dd-item><a href=/navpatterns/1-patterns/multi-file-download/>Multi-file Download</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/multi-page-list/ title="Multi-Page List" class=dd-item><a href=/navpatterns/1-patterns/multi-page-list/>Multi-Page List</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/multilanguage-application-data/ title="Multilanguage Application Data" class=dd-item><a href=/navpatterns/1-patterns/multilanguage-application-data/>Multilanguage Application Data</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/net-exception-handling-in-cal/ title="NET Exception Handling in CAL" class=dd-item><a href=/navpatterns/1-patterns/net-exception-handling-in-cal/>NET Exception Handling in CAL</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/ title="TryFunction NET Exception Handling in CAL" class=dd-item><a href=/navpatterns/1-patterns/net-exception-handling-in-cal/tryfunction-net-exception-handling-in-cal/>TryFunction NET Exception Handling in CAL</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/no-series/ title="No Series" class=dd-item><a href=/navpatterns/1-patterns/no-series/>No Series</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/notifications/ title=Notifications class=dd-item><a href=/navpatterns/1-patterns/notifications/>Notifications</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/notifications/in-context-notifications/ title="In-context Notifications" class=dd-item><a href=/navpatterns/1-patterns/notifications/in-context-notifications/>In-context Notifications</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/notifications/notification-lifecycle-management-pattern/ title="Notification Lifecycle Management Pattern" class=dd-item><a href=/navpatterns/1-patterns/notifications/notification-lifecycle-management-pattern/>Notification Lifecycle Management Pattern</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/observer/ title=Observer class=dd-item><a href=/navpatterns/1-patterns/observer/>Observer</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/posting-routine-select-behavior/ title="Posting Routine - Select Behavior" class=dd-item><a href=/navpatterns/1-patterns/posting-routine-select-behavior/>Posting Routine - Select Behavior</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/product-name/ title="Product Name" class=dd-item><a href=/navpatterns/1-patterns/product-name/>Product Name</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/ title=Queries class=dd-item><a href=/navpatterns/1-patterns/queries/>Queries</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/select-distinct-with-queries/ title="SELECT DISTINCT with Queries" class=dd-item><a href=/navpatterns/1-patterns/queries/select-distinct-with-queries/>SELECT DISTINCT with Queries</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/ title="use Queries to Detect Duplicate Records" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-detect-duplicate-records/>use Queries to Detect Duplicate Records</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/queries/use-queries-to-replace-nested-loops/ title="Use Queries to Replace Nested Loops" class=dd-item><a href=/navpatterns/1-patterns/queries/use-queries-to-replace-nested-loops/>Use Queries to Replace Nested Loops</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/read-once-initialization-and-validation/ title="Read-once Initialization and Validation" class=dd-item><a href=/navpatterns/1-patterns/read-once-initialization-and-validation/>Read-once Initialization and Validation</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/released-entity/ title="Released Entity" class=dd-item><a href=/navpatterns/1-patterns/released-entity/>Released Entity</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/report-selection/ title="Report Selection" class=dd-item><a href=/navpatterns/1-patterns/report-selection/>Report Selection</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/security/ title=Security class=dd-item><a href=/navpatterns/1-patterns/security/>Security</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/setup-specificity-fallback/ title="Setup Specificity Fallback" class=dd-item><a href=/navpatterns/1-patterns/setup-specificity-fallback/>Setup Specificity Fallback</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/silent-file-upload-and-download/ title="Silent File Upload and Download" class=dd-item><a href=/navpatterns/1-patterns/silent-file-upload-and-download/>Silent File Upload and Download</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/ title=Singleton class=dd-item><a href=/navpatterns/1-patterns/singleton/>Singleton</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-codeunit/ title="Singleton Codeunit" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-codeunit/>Singleton Codeunit</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-table/ title="Singleton Table" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-table/>Singleton Table</a><ul>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-table/cue-table/ title="Cue Table" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-table/cue-table/>Cue Table</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/singleton/singleton-table/setup-table/ title="Setup Table" class=dd-item><a href=/navpatterns/1-patterns/singleton/singleton-table/setup-table/>Setup Table</a></li></ul></li></ul></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/standard-journal/ title="Standard Journal" class=dd-item><a href=/navpatterns/1-patterns/standard-journal/>Standard Journal</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/temporary-dataset-report/ title="Temporary Dataset Report" class=dd-item><a href=/navpatterns/1-patterns/temporary-dataset-report/>Temporary Dataset Report</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/totals-and-discounts-on-subpages-sales-and-purchases/ title="Totals and Discounts on Subpages Sales and Purchases" class=dd-item><a href=/navpatterns/1-patterns/totals-and-discounts-on-subpages-sales-and-purchases/>Totals and Discounts on Subpages Sales and Purchases</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/transfer-custom-fields/ title="Transfer Custom Fields" class=dd-item><a href=/navpatterns/1-patterns/transfer-custom-fields/>Transfer Custom Fields</a></li>
|
|
<li data-nav-id=/navpatterns/1-patterns/variant-facade/ title="Variant Facade" class=dd-item><a href=/navpatterns/1-patterns/variant-facade/>Variant Facade</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/2-anti-patterns/ title="2. Anti-Patterns" class=dd-item><a href=/navpatterns/2-anti-patterns/>2. Anti-Patterns</a><ul>
|
|
<li data-nav-id=/navpatterns/2-anti-patterns/nav-upgrade/ title="Nav Upgrade" class=dd-item><a href=/navpatterns/2-anti-patterns/nav-upgrade/>Nav Upgrade</a></li>
|
|
<li data-nav-id=/navpatterns/2-anti-patterns/reusable-bugs/ title="Reusable Bugs" class=dd-item><a href=/navpatterns/2-anti-patterns/reusable-bugs/>Reusable Bugs</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ title="3. CAL Coding Guidelines" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/>3. CAL Coding Guidelines</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/design/ title=Design class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/design/>Design</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/ title="Internally-used DotNet Types" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internally-used-dot-net-types/>Internally-used DotNet Types</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internationalization/ title=Internationalization class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internationalization/>Internationalization</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/internationalization/using-calcdate/ title="Using Calcdate" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/internationalization/using-calcdate/>Using Calcdate</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/ title=Localizability class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/>Localizability</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/ title="CaptionML on System Pages" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/captionml-for-system-tables/>CaptionML on System Pages</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/ title="FIELDCAPTION and TABLECAPTION" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/fieldcaption-and-tablecaption/>FIELDCAPTION and TABLECAPTION</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/global-text-constants/ title="Global Text Constants" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/global-text-constants/>Global Text Constants</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/use-text-constants/ title="Use Text Constants" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/use-text-constants/>Use Text Constants</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/ title="Using OptionCaptionML" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/localizability/using-optioncaptionml/>Using OptionCaptionML</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/ title=Readability class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/>Readability</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/ title="Begin as an 'After Word'" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/begin-as-an-afterword/>Begin as an 'After Word'</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/begin-end/ title="Begin-End - Compound Only" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/begin-end/>Begin-End - Compound Only</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/ title="Binary Operator to Start Line" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/binary-operator-line-start/>Binary Operator to Start Line</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/ title="Blank Lines.md" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/blank-lines/>Blank Lines.md</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/case-actions/ title="CASE Action" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/case-actions/>CASE Action</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/ title="Colon usage in CASE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/colon-usage-in-case/>Colon usage in CASE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/ title="Comments inside Curly Brackets" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/comments-curly-brackets/>Comments inside Curly Brackets</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/comments-spacing/ title="Comment Spacing" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/comments-spacing/>Comment Spacing</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/end-else-pair/ title="END ELSE Pair" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/end-else-pair/>END ELSE Pair</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/indentation/ title=Indentation class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/indentation/>Indentation</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/ title="Keyword Pairs - Indentation" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/keyword-pairs-indentation/>Keyword Pairs - Indentation</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/line-start-keywords/ title="Line Start Keywords" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/line-start-keywords/>Line Start Keywords</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/lonely-repeat/ title="Lonely Repeat" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/lonely-repeat/>Lonely Repeat</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/named-invocations/ title="Named Invocations" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/named-invocations/>Named Invocations</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/nested-withs/ title="Nested WITHs" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/nested-withs/>Nested WITHs</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/one-statement-per-line/ title="One Statement Per Line" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/one-statement-per-line/>One Statement Per Line</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/separate-if-and-else/ title="Separate IF and ELSE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/separate-if-and-else/>Separate IF and ELSE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/ title="Spacing Binary Operators" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/spacing-binary-operators/>Spacing Binary Operators</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/ title="Spacing Brackets and ::" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/spacing-brackets-and/>Spacing Brackets and ::</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/ title="Spacing Unary Operators" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/spacing-unary-operators/>Spacing Unary Operators</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/ title="Suggested Abbreviations" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/suggested-abbreviations/>Suggested Abbreviations</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/ title="Temporary Variable Naming" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/temporary-variable-naming/>Temporary Variable Naming</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/textconst-suffixes/ title="TextConst Suffixes" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/textconst-suffixes/>TextConst Suffixes</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/ title="Unary Operator Line End" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unary-operator-line-end/>Unary Operator Line End</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/ title="Unnecessary Compound Parenthesis" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-compound-parenthesis/>Unnecessary Compound Parenthesis</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-else/ title="Unnecessary ELSE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-else/>Unnecessary ELSE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/ title="Unnecessary Function Parenthesis" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-function-parenthesis/>Unnecessary Function Parenthesis</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-separators/ title="Unnecessary Separators" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-separators/>Unnecessary Separators</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/ title="Unnecessary TRUE/FALSE" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/unnecessary-truefalse/>Unnecessary TRUE/FALSE</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/variable-already-scoped/ title="Variable Already Scoped" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/variable-already-scoped/>Variable Already Scoped</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/variable-naming/ title="Variable Naming" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/variable-naming/>Variable Naming</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/readability/variables-declarations-order/ title="Variables Declarations Order" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/readability/variables-declarations-order/>Variables Declarations Order</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/ title=UX class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/>UX</a><ul>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/actions-images/ title="Actions - Images" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/actions-images/>Actions - Images</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/confirm/ title=CONFIRM class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/confirm/>CONFIRM</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/fielderror/ title=FIELDERROR class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/fielderror/>FIELDERROR</a></li>
|
|
<li data-nav-id=/navpatterns/3-cal-coding-guidelines/ux/message-and-error/ title="MESSAGE and ERROR" class=dd-item><a href=/navpatterns/3-cal-coding-guidelines/ux/message-and-error/>MESSAGE and ERROR</a></li></ul></li></ul></li>
|
|
<li data-nav-id=/navpatterns/4-get-involved/ title="(OLD) Get Involved" class=dd-item><a href=/navpatterns/4-get-involved/>(OLD) Get Involved</a><ul>
|
|
<li data-nav-id=/navpatterns/4-get-involved/code-of-conduct/ title="Code of Conduct" class=dd-item><a href=/navpatterns/4-get-involved/code-of-conduct/>Code of Conduct</a></li>
|
|
<li data-nav-id=/navpatterns/4-get-involved/patterns-authors/ title="Patterns Authors" class=dd-item><a href=/navpatterns/4-get-involved/patterns-authors/>Patterns Authors</a></li>
|
|
<li data-nav-id=/navpatterns/4-get-involved/template-for-writing-nav-design-patterns/ title="Template for writing Nav Design Patterns" class=dd-item><a href=/navpatterns/4-get-involved/template-for-writing-nav-design-patterns/>Template for writing Nav Design Patterns</a></li></ul></li>
|
|
<li data-nav-id=/navpatterns/related-links/ title="Related Links" class=dd-item><a href=/navpatterns/related-links/>Related Links</a></li></ul></li>
|
|
</ul>
|
|
<div id=shortcuts>
|
|
<div class=nav-title>More</div>
|
|
<ul>
|
|
<li><a class=padding href=https://discord.gg/4wbfNv3><i class="fab fa-discord"></i> BC Discord</a></li>
|
|
<li><a class=padding href=https://github.com/microsoft/bcalhelp><i class="fab fa-github"></i> GitHub repo</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id=footer>
|
|
<p>Built with <a href=https://github.com/McShelby/hugo-theme-relearn><i class="fas fa-heart"></i></a> by <a href=https://gohugo.io/>Hugo</a></p>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div id=body>
|
|
<div id=overlay></div>
|
|
<div class="padding highlightable">
|
|
<div id=top-bar>
|
|
<div id=top-github-link>
|
|
<a class=github-link title="Edit this page" href=https://github.com/microsoft/bcalhelp/edit/main/content/NAVPatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/index.md target=blank>
|
|
<i class="fas fa-code-branch"></i>
|
|
<span id=top-github-link-text>Edit this page</span>
|
|
</a>
|
|
</div>
|
|
<div id=breadcrumbs>
|
|
<span id=sidebar-toggle-span>
|
|
<a href=# id=sidebar-toggle data-sidebar-toggle>
|
|
<i class="fas fa-bars"></i>
|
|
</a>
|
|
</span>
|
|
<span id=toc-menu><i class="fas fa-list-alt"></i></span>
|
|
<ol class=links itemscope itemtype=http://schema.org/BreadcrumbList>
|
|
<meta itemprop=itemListOrder content="Descending">
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="4"><a itemprop=item href=/><span itemprop=name>Home</span></a> > </li>
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="3"><a itemprop=item href=/navpatterns/><span itemprop=name>NAV Patterns Archive</span></a> > </li>
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="2"><a itemprop=item href=/navpatterns/1-patterns/><span itemprop=name>1. Patterns</span></a> > </li>
|
|
<li itemscope itemtype=https://schema.org/ListItem itemprop=itemListElement><meta itemprop=position content="1"><a itemprop=item href=/navpatterns/1-patterns/implementation-of-surrogate-keys-using-autoincrement-pattern/ aria-disabled=true><span itemprop=name>Surrogate keys using Autoincrement Pattern</span></a></li>
|
|
</ol>
|
|
</div>
|
|
<div class=progress>
|
|
<div class=wrapper>
|
|
<nav id=TableOfContents>
|
|
<ul>
|
|
<li><a href=#abstract><strong>Abstract</strong></a></li>
|
|
<li><a href=#description><strong>Description</strong></a></li>
|
|
<li><a href=#usage><strong>Usage</strong></a></li>
|
|
<li><a href=#nav-specific-example><strong>NAV Specific Example</strong></a></li>
|
|
<li><a href=#nav-usages><strong>NAV Usages</strong></a></li>
|
|
<li><a href=#ideas-for-improvement->**Ideas for improvement ******</a></li>
|
|
<li><a href=#consequences-when-it-should-not-be-used><strong>Consequences (When it should not be used)</strong></a></li>
|
|
<li><a href=#related-topics><strong>Related Topics</strong></a></li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id=head-tags>
|
|
</div>
|
|
<main id=body-inner>
|
|
<h1>Surrogate keys using Autoincrement Pattern</h1>
|
|
<p><em>By <a href=http://mvp.microsoft.com/en-us/mvp/Soren%20Klemmensen-5001002 title="Soren Klemmensen">Soren Klemmensen</a>, <a href=http://partner-ready-software.com/ title=Partner-Ready-Software><em>Partner-Ready-Software</em> </a>& <a href=http://www.360visibility.com/ title="360 Visibility">360 Visibility</a></em></p>
|
|
<h2 id=abstract><strong>Abstract</strong></h2>
|
|
<p>This Pattern is meant to create generic & reusable links between tables. The goal is to have an easy generic way to link a generically designed sub table to a record on a main table which can be used for other links too.</p>
|
|
<p>To minimize the impact of customizations and to keep modules as generic and reusable as possible the idea of the Implementation of surrogate keys using AutoIncrement pattern is:</p>
|
|
<ul>
|
|
<li>To create a generic and reusable auto generated link (A Surrogate Key), Immune to natural key data & requirement changes, on a main table with minimum impact on the table.</li>
|
|
<li>To create generic and reusable sub tables that effortless can be reused anywhere in the application.</li>
|
|
</ul>
|
|
<h2 id=description><strong>Description</strong></h2>
|
|
<p>Over years of development many things are repeated across different implementation and even inside the same application. A typical example could be adding comments to an area just as it is done in Microsoft Dynamics NAV multiple times. There can be reasons for doing this again and again, but not only does this need to be maintained and upgraded over the years, but all the implementations of comments also needs to be tested separately. If a standard and generic comment could be developed and a generic way of connecting it to a main table this could be resolved. This is exactly what this pattern is trying accomplish.</p>
|
|
<p><a href=0458.Figure-1.PNG><img src=0458.Figure-1.PNG alt=" "></a></p>
|
|
<p><em>Figure 1: Table structure for linking a Document Header and Line Table with a Document Comment Table.</em></p>
|
|
<p>__</p>
|
|
<p>_<a href=0638.Figure-2.PNG><img src=0638.Figure-2.PNG alt=" "></a>_</p>
|
|
<p><em>Figure 2: Table Structure for linking a Master Data Table with a Master Data Comment Table</em></p>
|
|
<p>__</p>
|
|
<p>A typical way of linking a table to master data or to a document has been to use the primary key of the table being linked to. This causes some issues as the linked table now is designed specifically for the main table and it functionality cannot be reused. In case of renames the linked table needs to be renamed too which is costly in processing. Code also needs to be added on the delete trigger of the table to ensure that the attached records get removed if needed which increases the over all footprint of any change.</p>
|
|
<p>_<a href=0333.Figure-3.PNG><img src=0333.Figure-3.PNG alt=" "></a>_</p>
|
|
<p><em>Figure 3: A Generic Way of creating a Comment table and linking it in a generic way to the main table no matter what this table might be. The Unique Record Identifier on the main tables is an Integer with AutoIncrement set to yes.</em></p>
|
|
<p>__</p>
|
|
<p>It is recommended using this pattern in all tables which need sub tables unless specific reasons exists for not doing this.</p>
|
|
<h2 id=usage><strong>Usage</strong></h2>
|
|
<p><strong>Step 1</strong>: Create a generic Unique Record Identifier in the main table</p>
|
|
<p>The Pattern is implemented by adding a Field (I have called it Unique Record Identifier for this article) in a table (the main Table) where links are needed to be established to. Set the Property Data Type to Integer, Editable to No & AutoIncrement to Yes.</p>
|
|
<p><strong>Step 2</strong>: Create a generic link-able sub table.</p>
|
|
<p>Create a new table (Sub Table) which you would like to be reusable with a primary key containing</p>
|
|
<ul>
|
|
<li>Table No. of Data Type Integer</li>
|
|
<li>Unique Record Identifier of Data Type Integer</li>
|
|
<li>A 3 field for allowing multiple entries to exist per record in the main table if so needed. This could be a Line No. of Data Type Integer or a Code field of Data Type Code(10) and so on.</li>
|
|
</ul>
|
|
<p>The important part here is that the 2 or 3 first fields in the tables primary key is the Table No. and the Unique Record Identifier. If a 3rd field was added to allow for multiple entries to exist per record in the main table this should also be included in the primary key.</p>
|
|
<p>Make sure to also add any other fields containing the information you wish to store as needed to the table.</p>
|
|
<p>The sub table will be immune to renames from the main table as the main tables primary key is not used in the primary key of the sub table. The Insert, Modify and Rename triggers are not causing any issues and only the delete trigger will need to be considered. This can be dealt with generically from the OnDatabaseDelete trigger in Codeunit 1. I would recommend to use a Hook Pattern for this.</p>
|
|
<p><strong>Step 3</strong>: Create a page showing the sub table information.</p>
|
|
<p>Now create a page showing the data in the sub table.</p>
|
|
<p><strong>Step 4</strong>: Add an Action or factbox.</p>
|
|
<p>Create an action or factbox on the pages showing the main table data linking to the subpage with Table ID filtered to a constant of the Table No. of the main table and the Unique Record Identifier of the sub table filtering to the Unique Record Identifier of the main table.</p>
|
|
<p><strong>Step 5</strong>: Create a Hook for Function OnDatabaseDelete in Codeunit 1 ApplicationManagement if one doesn’t already exist. See the Hook pattern.</p>
|
|
<p><strong>Step 6</strong>: Create a code to delete records in the Sub table if a main table record is deleted if this is required. This function needs to be called from the Hook created in Step 5.</p>
|
|
<h2 id=nav-specific-example><strong>NAV Specific Example</strong></h2>
|
|
<p>Let’s assume we would like to create comment for a larger number of very different tables in the system.</p>
|
|
<p><strong>Update the Customer table (Step 1)</strong>: Go to table 18 Customer and add Field 50000 Unique Record Identifier. Set the Property Data Type to Integer, Editable to No & AutoIncrement to Yes. Save the changes.</p>
|
|
<p>_<a href=1488.Example-Figure-1.png><img src=1488.Example-Figure-1.png alt=" "></a>_</p>
|
|
<p>__</p>
|
|
<p>_<a href=4682.Example-Figure-2.png><img src=4682.Example-Figure-2.png alt=" "></a>_</p>
|
|
<p>__</p>
|
|
<p><strong>Create Comment table (Step 2)</strong>: Create a new table called Comment. Add 3 fields Table No., Unique Record Identifier & Line No. all of Data Type Integer. Make these 3 fields into the primary key for the table. Add a 4 field called Comment with Data Type Text(80). Save the changes.</p>
|
|
<p><a href=4532.Example-Figure-3.png><img src=4532.Example-Figure-3.png alt=" "></a></p>
|
|
<p><strong>Create the Comments page (Step 3)</strong>: Start the page wizard and create a Page based on table comment created above as a List only showing the Comment field. Set AutoSplitKey property to Yes on the page.</p>
|
|
<p>__</p>
|
|
<p>_<a href=2068.Example-Figure-4.png><img src=2068.Example-Figure-4.png alt=" "></a>_</p>
|
|
<p>__</p>
|
|
<p><strong>Update the Customer Card (Step 4)</strong>: Add an action to the Customer Card to open the Comments. Go to Actions and create an action called Smart Comment. Populate the properties RunObject, RunPageView and RunPageLink as see in the picture below.</p>
|
|
<p><a href=/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-42/0552.Example-Figure-5.png><img src=0552.Example-Figure-5.png alt=" "></a></p>
|
|
<p>__</p>
|
|
<p><strong>Create a hook OnDatabaseDelete (Step 5)</strong>:</p>
|
|
<p>Create a codeunit 50000 called “ApplicationManagement Hook” with one function called OnAfterOnDatabaseDelete taking the parameter RecRef of Data Type RecordRef. Add it as a global variable to Codeunit 1 ApplicationManagement and call the function as the last line in OnDatabaseDelete. Please read about the hook pattern before implementing it.</p>
|
|
<p><a href=/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-42/4477.Example-Figure-6.png><img src=4477.Example-Figure-6.png alt=" "></a></p>
|
|
<p>__</p>
|
|
<p><strong>Create the code needed to delete comments linked to a deleted record (Step6)</strong>:</p>
|
|
<p>Create a DeleteComments function taking the RecRef of Data Type RecordRef and add the code as shown blow.</p>
|
|
<p><a href=/cfs-file.ashx/__key/communityserver-wikis-components-files/00-00-00-00-42/1884.Example-Figure-7.png><img src=1884.Example-Figure-7.png alt=" "></a></p>
|
|
<p>__</p>
|
|
<p>It is assumed in this example for simplicity that the Field 50000 is reserved across the entire application for the Unique Record Identifier as defined in Step 1.</p>
|
|
<p>The comments are now fully working if we look away from the fact that we did not deal with a few things specific to Sales orders like RecreateSalesLines function, Archiving and Copy Document. All of which can easily be dealt with.</p>
|
|
<p>These comments are now completely reusable everywhere else in the system. Sales Document is a perfect example as the primary keys of the Sales Header and the Sales line are both different from the customer and normally we would not be able to use the comments header or the line. All that needs to be done is adding the Field 50000 Unique Record Identifier to the Sales Header & Sales Line (Disregarding the posted documents in this example) and creating the actions on the Page Actions with the needed filters. Deletion is already handled of comments no matter what the main table might be.</p>
|
|
<p>Looking at the main table the Unique Record Identifier is also completely reusable for any other linking needed.</p>
|
|
<p>Other ideas for use of this pattern could be. An Error table, Tags, Dynamically defined fields and Generic fact boxes. Only the imagination sets limits for its use.</p>
|
|
<p>Upgrade wise there can be an impact if data is moved out of tables to be reinserted again because of a change to a database structure. This will cause the Unique Record Identifier to change, unless steps are taken to avoid this, and the links will need to be reestablished.</p>
|
|
<p>Other risks could be if Transfer Fields are used and data is being copied unintentionally.</p>
|
|
<h2 id=nav-usages><strong>NAV Usages</strong></h2>
|
|
<p>This is a new pattern not currently used in Microsoft Dynamics NAV.</p>
|
|
<h2 id=ideas-for-improvement->**Ideas for improvement ******</h2>
|
|
<p>The reason for doing it this way is that you now can reuse your code again and again with only creating the same link on other tables instead of building it from scratch each time reducing testing needed and improving the quality of the overall product.</p>
|
|
<h2 id=consequences-when-it-should-not-be-used><strong>Consequences (When it should not be used)</strong></h2>
|
|
<p>This can be used on any table when linking anything to it that can be considered a generic module which can be reused. That said it should not be used in cases where there is a risk of tables growing so much that performance could be impacted. There are ways to reduce performance impact when using high volume tables, but that is outside the scope of this pattern.</p>
|
|
<h2 id=related-topics><strong>Related Topics</strong></h2>
|
|
<p>This is related to the hook pattern as far as they both try to reduce the footprint changes have on the standard application, by creating reusable ways to interact with the standard code. That said the hook pattern is more about hooking the functionality to existing while this pattern is more about creating reusable ways of creating functionality.</p>
|
|
<p>__</p>
|
|
<footer class=footline>
|
|
</footer>
|
|
</main>
|
|
</div>
|
|
<div id=navigation>
|
|
<a class="nav nav-prev" href=/navpatterns/1-patterns/hooks/ title=Hooks><i class="fa fa-chevron-left"></i></a>
|
|
<a class="nav nav-next" href=/navpatterns/1-patterns/instructions-in-the-ui/ title="Instructions in the UI"><i class="fa fa-chevron-right"></i></a>
|
|
</div>
|
|
</div>
|
|
<div style=left:-1000px;overflow:scroll;position:absolute;top:-1000px;border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px>
|
|
<div style=border:none;box-sizing:content-box;height:200px;margin:0;padding:0;width:200px></div>
|
|
</div>
|
|
<script src=/js/clipboard.min.js?1636530359></script>
|
|
<script src=/js/perfect-scrollbar.min.js?1636530359></script>
|
|
<script src=/js/perfect-scrollbar.jquery.min.js?1636530359></script>
|
|
<script src=/js/jquery.svg.pan.zoom.js?1636530359></script>
|
|
<script src=/js/featherlight.min.js?1636530359></script>
|
|
<script src=/js/modernizr.custom-3.6.0.js?1636530359></script>
|
|
<script src=/js/relearn.js?1636530359></script>
|
|
</body>
|
|
</html> |