473,408 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

.NET "Record Layouts"... like Dibol?

Hi,
Below is sample output in x12 EDI format. I'm using vb.net to create this
output file but i'm not sure if .NET has any tools to make the coding more
organized and/or efficient. Right now the only way i can think to create
each segment is by hardcoding the different elements into a string. For
example, to create the N1 segment i'll do this:

Dim sN1 as string = "N1*IM*" & drv("importer_name") & "*" &
drv("consignee_code") & "*" & drv("consignee_name")

I would do this for each record. This looks a little clumsy and was
wondering if there's maybe a way to predefine these record layouts or create
a template or some sort which can be used to make things easier to read. I'm
used to working with Dibol where you can create record layouts for this kind
of stuff. Advice will be greatly appreciated. Thanks!

ISA*00* *00* *ZZ*SENDER *ZZ*CBP
*070822*0940*#*00501*000000001*0*T*:
GS*SF*SENDER*CBP*070822*0940*1*Y*005010
ST*333*0001
BGN*00*1234567-8*20070822*1005*LT**ET
V1*7777777*******L*S
N9*FC*FLR
N7*SCA1*1234567
N7*SCA2*9876543
N1*IM*Importer*93*99-999999900
N1*CN**93*99-999999900
N1*IU*SCA3
N9*BM*1111111111
N1*IU*MAEU
N9*MB*2222222222
N1*SE*SellerName1
N3*123 Seller Street
N4*SHENZHEN**518008*CN
N1*SE*SellerName2
N3*555 POS Avenue
N4*SHENZHEN**518008*CN
N1*BY*Buyer
N3*777 Buyer Boulevard
N4*Seattle*WA*98101*US
N1*ST*Buyer - Loc1
N3*555 Shipto Avenue
N4*Seattle*WA*98101*US
N1*X2*StuffingLoc
N3*333 StuffLoc Street
N4*SHENZHEN**518008*CN
N1*CS*ConsolidatorName
N3*999 Consolidator Court
N4*SHENZHEN**518008*CN
N1*ST*Buyer - Loc2
N3*987 Shipto Street
N4*Indianapolis*IN*98101*US
N1*MF*ManufacturerName1
N3*1357 Manufacturer Way
N4*SHENZHEN**518008*CN
TC2*A*HTSCD1
N1*CT*China*38*CN
TC2*A*HTSCD2
N1*CT*China*38*CN
N1*MF*ManufacturerName2
N3*555 Maker's Street
N4*TSIM SHA TSUI EAST KOWLOON***HK
TC2*A*HTSCD3
N1*CT*Hong Kong*38*HK
SE*46*0001
GE*1*1
IEA*1*000000001
Oct 11 '07 #1
3 1932
Dim sN1 as string = "N1*IM*" & drv("importer_name") & "*" &
drv("consignee_code") & "*" & drv("consignee_name")
I would use a template String and a string.Format thus:
-------------------------------------------------------------
Dim Template as String = "N1*IM{0}*{1}*{2}"
Dim ThisRecord as String = string.Format(Template,drv("importer_name"),drv("c onsignee_code"),
drv("consignee_name")
-------------------------------------------------------------

I would also probably use constants instead of literals for 'importer_name'
etc

--
Rory
Oct 11 '07 #2
Thanks! I wasn't aware of template strings. I believe this will work for me.

"Rory Becker" wrote:
Dim sN1 as string = "N1*IM*" & drv("importer_name") & "*" &
drv("consignee_code") & "*" & drv("consignee_name")

I would use a template String and a string.Format thus:
-------------------------------------------------------------
Dim Template as String = "N1*IM{0}*{1}*{2}"
Dim ThisRecord as String = string.Format(Template,drv("importer_name"),drv("c onsignee_code"),
drv("consignee_name")
-------------------------------------------------------------

I would also probably use constants instead of literals for 'importer_name'
etc

--
Rory
Oct 11 '07 #3
I wrote classes for each segment type and a class called X12Segment that
they all inherit from.

John Walker wrote:
Hi,
Below is sample output in x12 EDI format. I'm using vb.net to create this
output file but i'm not sure if .NET has any tools to make the coding more
organized and/or efficient. Right now the only way i can think to create
each segment is by hardcoding the different elements into a string. For
example, to create the N1 segment i'll do this:

Dim sN1 as string = "N1*IM*" & drv("importer_name") & "*" &
drv("consignee_code") & "*" & drv("consignee_name")

I would do this for each record. This looks a little clumsy and was
wondering if there's maybe a way to predefine these record layouts or create
a template or some sort which can be used to make things easier to read. I'm
used to working with Dibol where you can create record layouts for this kind
of stuff. Advice will be greatly appreciated. Thanks!

ISA*00* *00* *ZZ*SENDER *ZZ*CBP
*070822*0940*#*00501*000000001*0*T*:
GS*SF*SENDER*CBP*070822*0940*1*Y*005010
ST*333*0001
BGN*00*1234567-8*20070822*1005*LT**ET
V1*7777777*******L*S
N9*FC*FLR
N7*SCA1*1234567
N7*SCA2*9876543
N1*IM*Importer*93*99-999999900
N1*CN**93*99-999999900
N1*IU*SCA3
N9*BM*1111111111
N1*IU*MAEU
N9*MB*2222222222
N1*SE*SellerName1
N3*123 Seller Street
N4*SHENZHEN**518008*CN
N1*SE*SellerName2
N3*555 POS Avenue
N4*SHENZHEN**518008*CN
N1*BY*Buyer
N3*777 Buyer Boulevard
N4*Seattle*WA*98101*US
N1*ST*Buyer - Loc1
N3*555 Shipto Avenue
N4*Seattle*WA*98101*US
N1*X2*StuffingLoc
N3*333 StuffLoc Street
N4*SHENZHEN**518008*CN
N1*CS*ConsolidatorName
N3*999 Consolidator Court
N4*SHENZHEN**518008*CN
N1*ST*Buyer - Loc2
N3*987 Shipto Street
N4*Indianapolis*IN*98101*US
N1*MF*ManufacturerName1
N3*1357 Manufacturer Way
N4*SHENZHEN**518008*CN
TC2*A*HTSCD1
N1*CT*China*38*CN
TC2*A*HTSCD2
N1*CT*China*38*CN
N1*MF*ManufacturerName2
N3*555 Maker's Street
N4*TSIM SHA TSUI EAST KOWLOON***HK
TC2*A*HTSCD3
N1*CT*Hong Kong*38*HK
SE*46*0001
GE*1*1
IEA*1*000000001
Oct 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dario de Judicibus | last post by:
I wish to create two simple layouts by using only HTML, CSS and the minimum JavaScript as possible. Layouts should be "elastic" (no fixed widths and heights) and cross-browser enabled. The first...
7
by: Alan J. Flavell | last post by:
A colleague recently breezed in with a new web page design. He didn't tell me where he got the ideas from, but ... Looking at his stylesheets, I noticed they identified themselves as...
0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
4
by: Tim | last post by:
I have used a graphic 'next record' button on a form. How can I stop it from going past the last existing record? In other words, I don't want it to take the user to a blank record. Thanks Tim
3
by: Lee-Anne Waters via AccessMonster.com | last post by:
Hello, i have just upgraded my database from access 97 to access 2000 and updated all the jet paks. however when i use my import functions to import orders (.csv) one order will appear as a group...
3
by: vanvee | last post by:
Hi I am trying to program a VB.Net Windows application (in a client server environment with multiple users) and am seeking some help about a possible technique to handle concurreny issues. I am...
3
by: domcatanzarite | last post by:
How would one create a button that on click advances the form to the next "non recurring record" as opposed to the next record. The field the button needs to que from has groups of duplicate...
1
by: AA Arens | last post by:
I my form I have put record navigation buttons. When I choose just before the last record, the "Go to next record" button, access automatically start with a new record instead of a message that...
25
by: tekctrl | last post by:
Anyone: I have a simple MSAccess DB which was created from an old ASCII flatfile. It works fine except for something that just started happening. I'll enter info in a record, save the record,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.