eBiss 3

Hilfe & Dokumentation

User Tools

Site Tools


en:transformation:mappings:objektdefinition:klassenaufbau:class_flatfile

Example of integration via file exchange with CSV files and different line types

Sample files are under StandardTemplates\PluginSample\FlatFile.Sample.

The following example shows the class structure of an ORDERS object for integration with CSV files and five different line types. The line types are in the first column of the respective line and are as follows:

  1. 1001)
  2. 2002)

The ORDER class implements the interface IMapObjectRoot. Since mapping objects are structured as a tree structure, the interface IMapObjectRoot is the highest instance of this tree structure. The variables that are declared with the keyword public within the class are displayed as data elements as segments within the object tree structure. The class Kopf contains the header information of the ORDERS and implements the interface IMapObjectItem. This may only occur once per file. The class Position represents the item list of the ORDERS object. It also implements the interface IMapObjectItem, which represents the objects of the item list. These can be contained several times in the array list items of the class Kopf 6), while the Kopf are only available once.

Note: For the automated processing or recognition of entity types, appropriate settings must be made in the Type repositories.

Read component setting

Note: Processing CSV files with line types requires a specific setting of the read component of the entity type. The main parameters are here:

parameter name Value
SeparatorSemicolon
RecordTagPosition0
StartAtLine1

Sample C# Code

Note: using eBiss.Api;

namespace Pranke.CSV.Sample 
{
	public class ORDER: IMapObjectRoot
	{
		[MapTrigger,Description("Kopf"),MapExternalName("100")]
		public Kopf Kopf;
	}
 
	public class Kopf: IMapObjectItem
	{
		[MapSize(40)]
		public String Lieferadresse;
		[MapSize(25)]
		public String ContactPerson;
		[MapSize(10)]
		public String CustomerRef;
		[MapSize(3)]
		public String CurrencyCode;
		[MapSize(4)]
		public String Year;
		[MapSize(2)]
		public String Month;
		[MapSize(2)]
		public String Day;
		[MapSize(35)]
		public String Text1;
		[MapSize(35)]
		public String Text2;
		[MapListType(typeof(Position)),Description("Position"),MapExternalName("200"),MapRequired]
		public ArrayList Position;
	}
 
	public class Position: IMapObjectItem
	{
		[Description("Pos.-Number"),MapSize(3)]
		public String Number;
		[Description("ext. Articlenumber"),MapSize(15)]
		public String Articlenumber;
		[MapSize(10)]
		public String Amount;
		[MapSize(11)]
		public String Price;
		[Description("Note1"),MapSize(13)]
		public String Note1;
		[MapSize(35)]
		public String Note2;
	}
}

Example CSV file content

100Karlstraße 16b | D-76133 Karlsruhe      Pranke                   4711K     EUR20181 1 Text1                              Text2                              
2001  4711           10        10.4       Note1        Note2                              
2002  4712           22        9.87       Note1        Note2                              

Example XML file content

<?xml version="1.0" encoding="Windows-1252" standalone="yes"?>
<ORDER>
  <100 Debitorennummer=1 Lieferadresse="Karlstraße 16b | D-76133 Karlsruhe" ContactPerson="Pranke" CustomerRef="4711K" CurrencyCode="EUR" Year="2018" Month="1" Day="1" Text1="Text1" Text2="Text2">
    <200 Articlenumber="4711" Number="1" Amount="10" Price="10.4" Note1="Note1" Note2="Note2" >
    </200>
    <200 Articlenumber="4712" Number="2" Amount="22" Price="9.87" Note1="Note1" Note2="Note2" >
    </200>
  </100>
</ORDER>

Alternative example

An alternative example can be found under Creating a CSV PlugIn.

1)
= head information
2)
= the positions
en/transformation/mappings/objektdefinition/klassenaufbau/class_flatfile.txt · Last modified: 2024/02/20 08:15 by 127.0.0.1