Module CUSTIMP.PKG
1// Customer ascii importer `
2//
3// access method is:
4//
5// Send DoImport to CustImporter sFileName
6//
7
8Object CustImporter is a BusinessProcess
9 property string FileName ''
10 //set display_error_State to true
11 Set Allow_Cancel_State to True
12 Set Process_title to "Importing Test Customer data"
13 Set Status_log_id to (status_Log(self))
14 Set Status_log_State to true
15
16 Object Customer_DD is a Customer_DataDictionary
17 end_Object
18
19 procedure DoImport string sFile
20 set FileName to sFile
21 send DoProcess
22 End_Procedure
23
24 Procedure OnProcess
25 string sFile sData
26 integer hDD bErr bExit
27 Move Customer_DD to hDD
28 Get FileName to sFile
29 Direct_Input sFile
30 While (not(seqeof) and not(bExit))
31 Send clear to hDD
32 read sData
33 read sData
34 read sData
35 if ((seqeof) or sData="") break
36 Send Update_Status ("Adding " * sData)
37 Send Log_Status ("Adding " * sData)
38 Set Field_Changed_value of hDD FIELD Customer.Name to ("New:" * sData)
39 read sData
40 Set Field_Changed_value of hDD FIELD Customer.Address to sData
41 read sData
42 Set Field_Changed_value of hDD FIELD Customer.City to sData
43 read sData
44 Set Field_Changed_value of hDD FIELD Customer.State to sData
45 read sData
46 Set Field_Changed_value of hDD FIELD Customer.Zip to sData
47 readln sData
48 Get Request_Validate of hDD to bErr
49 if not bErr Send Request_save to hDD
50 Get Cancel_Check to bExit
51 Loop
52 Close_Input
53 end_Procedure
54
55 Procedure OnError
56 //set error_check_state to false
57 end_procedure
58
59End_Object
60