{"id":834,"date":"2010-12-02T15:02:34","date_gmt":"2010-12-02T23:02:34","guid":{"rendered":"http:\/\/45.63.48.66\/?p=834"},"modified":"2019-05-02T14:49:46","modified_gmt":"2019-05-02T21:49:46","slug":"beginners-tip-creating-and-handling-headers-in-dataports","status":"publish","type":"post","link":"https:\/\/gotcal.com\/index.php\/2010\/12\/beginners-tip-creating-and-handling-headers-in-dataports\/","title":{"rendered":"Beginners Tip: Creating and Handling Headers in Dataports"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-848\" title=\"classicrip\" src=\"http:\/\/gotcal.com\/wp-content\/uploads\/2010\/12\/classicrip.jpg\" alt=\"\" width=\"211\" height=\"239\">As &#8220;Dinosaur&#8221;-tech as it might seem these days with most blogs posting about RTC, dataports is still one of the easiest ways to import data into NAVision. Having to search my old databases for a quick way to handle headers in datafiles, i thought i would share this with you. Hopefully Google will answer you with this post next time you have to do it :).<\/p>\n<p>If you appreciate these beginners tips, let me know and i will dig into my archives before everyone leaves on the Dynamics Ark&#8230;.<\/p>\n<p>This small piece of code will handle writing headers when exporting, and also skip the first datarow when importing.<\/p>\n<p><!--more--><\/p>\n<pre class=\"brush: cal\">OnPreDataItem()\nIF NOT CurrDataport.IMPORT THEN BEGIN\n  Tab := 9; \/\/ 9=TAB, if you use another field seperator change it here!\n  \/\/ Write Header fields\n  CurrFile.TEXTMODE(TRUE);\n  CurrFile.WRITE(\n  'Item No (20)' +\n  FORMAT(Tab) +\n  'Description (30)');\n  CurrFile.TEXTMODE(FALSE);\nEND ELSE BEGIN\n  \/\/ Skip header\n  CurrFile.TEXTMODE(TRUE);\n  CurrFile.READ(Dummy); \/\/ read line into text variable\n  CurrFile.TEXTMODE(FALSE);\nEND;<\/pre>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>As &#8220;Dinosaur&#8221;-tech as it might seem these days with most blogs posting about RTC, dataports is still one of the easiest ways to import data into NAVision. Having to search my old databases for a quick way to handle headers in datafiles, i thought i would share this with you. Hopefully Google will answer you [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[56,3],"tags":[66,77,27,39],"class_list":["post-834","post","type-post","status-publish","format-standard","hentry","category-basic-cal","category-navision","tag-dataport","tag-navision","tag-how-to","tag-programming"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/comments?post=834"}],"version-history":[{"count":19,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/834\/revisions"}],"predecessor-version":[{"id":1013,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/834\/revisions\/1013"}],"wp:attachment":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/media?parent=834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/categories?post=834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/tags?post=834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}