Parsing an EDI file and populating the data into database table
Hi ,
Please help me in parsing an edi file and getting the required columns.
we get an EDI file from a bank. I need to parse that file and populate the db table with the required columns.
the file is '*' delimited and every line ends with '\'.
The record starts with 'ST*' and ends with 'SE*'.
sample edi file is
ISA*00* *00* *ZZ*043000096820 *ZZ*2156833510 *131202*0710*U*00401*000001204*0*P*>\ ignore first 2 lines
GS*RA*043000096820*2156833510*131202*0710*1204*X*003020\
ST*820*000041031\
BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\
TRN*1*101036661273032\
DTM*007*131202\
N1*1U*BPS\
N1*BE*MICHAEL DRAYTON*34*159783633\
N1*PE*BPS*ZZ*183383689C2 ABC\
N1*PR*ABC TREAS 310\
SE*9*000041031\ ST*820*000041032\
BPR*X*686*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\
TRN*1*101036661273034\
DTM*007*131202\
N1*1U*BPS\
N1*BE*SAMIA GRAVES*34*892909238\
N1*PE*BPS*ZZ*184545710C5 ABC\
N1*PR*ABC TREAS 310\
SE*9*000041032\
Below is the procedure I am trying to use for parsing that file. but the logic is not working. can you please help me in doing this. its very urgent requirement.
CREATE OR REPLACE package body p1 is
Function parse_spec(p_str varchar2) return t_str_nt is
begin
return regexp_replace(p_str,'\\$',null);
end;
procedure edi( is
l_out_file utl_file.file_type;
l_lin varchar2(200);
field1 number(9);
field2 varchar2(10 byte);
field3 varchar2(15 byte);
field4 varchar2(15 byte);
field5 varchar2(20 byte);
field6 varchar2(20 byte);
field7 varchar2(20 byte);
field8 varchar2(9 byte);
field9 varchar2(15 byte);
field10 varchar2(5 byte);
l_item_nt t_str_nt:=t_str_nt();
begin
l_out_file := utl_file.fopen (file_path, file_name, 'r');
IF utl_file.is_open(l_out_file) THEN
LOOP
BEGIN
l_item_nt:= utl_file.get_line(l_out_file, l_lin);
IF l_item_nt IS NULL THEN
raise no_data_found;
Else
for k in 1..l_item_nt.count loop
case
when l_item_nt(k) like 'ST*%' then
field1:= ltrim(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),0);
when l_item_nt(k) like 'BPR*X*%' then
field2 := regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
when l_item_nt(k) like 'TRN*1*%' then
field3:= regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
when l_item_nt(k) like 'DTM*007*%' then
field4:= regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3);
when l_item_nt(k) like '%*BE*%' then
field5 := regexp_substr(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),'[^ ]+', 1, 1);
field6 := regexp_substr(regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,3),'[^ ]+', 1, 1);
field7 := regexp_substr(parse_spec(l_item_nt(k)),'[^*]+',1,5);
when l_item_nt(k) like '%*PE*%*ZZ*%' then
field8:= regexp_substr(regexp_substr(parse_spec(line),'[^*]+',1,5),'[^ ]+',1,1)
field9 := regexp_substr(regexp_substr(parse_spec(line),'[^*]+',1,5),'[^ ]+',1,2);
when l_item_nt(k) like 'SE*%' then
insert into t1(field1,field2,field3,field5,field6,field7,field8,field9)
-- values(field1,field2,field3,field5,field6,field7,field8,field9);
else
dbms_output.put_line ('end of line');
end case;
end loop;
end if;
end loop;
utl_file.fclose(l_out_file);
exception
when no_data_found then
dbms_output.put_line('No data found');
end;
I would not use regular expressions for parsing as it is CPU intensive - and standard string processing suffices.
I would break the EDI up into lines. I would tokenise each line. I then have 2d array that can be referenced to find a specific field. E.g. line x and token y is field abc.
Basic approach:
SQL> create or replace type TStrings as table of varchar2(4000);
2 /
Type created.
SQL> -- create a parser that tokenises a string
SQL> create or replace function Tokenise(
2 csvLine varchar2,
3 separator varchar2 default ',',
4 enclosedBy varchar2 default null
5 ) return TStrings is
6 strList TStrings;
7 str varchar2(32767);
8 i integer;
9 l integer;
10 enclose1 integer;
11 enclose2 integer;
12 encloseStr varchar2(4000);
13 replaceStr varchar2(4000);
14
15 procedure AddString( line varchar2 ) is
16 begin
17 strList.Extend(1);
18 strList( strList.Count ) := Replace( line, CHR(0), separator );
19 end;
20
21 begin
22 strList := new TStrings();
23
24 str := csvLine;
25 loop
26 if enclosedBy is not null then
27 -- find the ennclosed text, if any
28 enclose1 := InStr( str, enclosedBy, 1 );
29 enclose2 := InStr( str, enclosedBy, 2 );
30
31 if (enclose1 > 0) and (enclose2 > 0) and (enclose2 > enclose1) then
32 -- extract the enclosed string
33 encloseStr := SubStr( str, enclose1, enclose2-enclose1+1 );
34 -- replace the separator char's with zero char's
35 replaceStr := Replace( encloseStr, separator, CHR(0) );
36 -- and remove the enclosed quotes
37 replaceStr := Replace( replaceStr, enclosedBy );
38 -- change the enclosed string in the big string to the replacement string
39 str := Replace( str, encloseStr, replaceStr );
40 end if;
41 end if;
42
43 l := Length( str );
44 i := InStr( str, separator );
45
46 if i = 0 then
47 AddString( str );
48 else
49 AddString( SubStr( str, 1, i-1 ) );
50 str := SubStr( str, i+1 );
51 end if;
52
53 -- if the separator was on the last char of the line, there is
54 -- a trailing null column which we need to add manually
55 if i = l then
56 AddString( null );
57 end if;
58
59 exit when str is NULL;
60 exit when i = 0;
61 end loop;
62
63 return( strList );
64 end;
65 /
Function created.
SQL>
SQL>
SQL> declare
2 ediDoc varchar2(32767) :=
3 'ISA*00* *00* *ZZ*043000096820 *ZZ*2156833510 *131202*0710*U*00401*000001204*0*P*>\GS*RA*043000096820*2156833510*131202*0710*1204*X*003020\ST*820*000041031\BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\TRN*1*101036661273032\DTM*007*131202\N1*1U*BPS\N1*BE*MICHAEL DRAYTON*34*159783633\N1*PE*BPS*ZZ*183383689C2 ABC\N1*PR*ABC TREAS 310\SE*9*000041031\ST*820*000041032\BPR*X*686*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202\TRN*1*101036661273034\DTM*007*131202\N1*1U*BPS\N1*BE*SAMIA GRAVES*34*892909238\N1*PE*BPS*ZZ*184545710C5 ABC\N1*PR*ABC TREAS 310\SE*9*000041032\';
4
5 lines TStrings;
6 tokens TStrings;
7 begin
8 -- split EDI string into lines
9 lines := Tokenise( ediDoc, '\' );
10
11 -- process line and extract fields
12 for i in 3..lines.Count loop
13 dbms_output.put_line( '***********************' ) ;
14 dbms_output.put_line( 'line=['||lines(i)||']' );
15 tokens := Tokenise( lines(i), '*' );
16
17 for j in 1..tokens.Count loop
18 dbms_output.put_line( to_char(j,'00')||'='||tokens(j) );
19 end loop;
20 end loop;
21 end;
22 /
line=[ST*820*000041031]
01=ST
02=820
03=000041031
line=[BPR*X*270*C*ACH*PPD*01*101036669***9101036669**01*031000053*DA*00000008606086714*131202]
01=BPR
02=X
03=270
04=C
05=ACH
06=PPD
07=01
08=101036669
09=
10=
11=9101036669
12=
13=01
14=031000053
15=DA
16=00000008606086714
17=131202
line=[TRN*1*101036661273032]
01=TRN
02=1
03=101036661273032
<snipped>
Similar Messages
-
How can i open a DOC or TXT file and insert the data into table?
How can i open a DOC or TXT file and insert the data into table?
I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
I'd like open DOC file and I'd like insert them into the table with same columns.
Thanks.Use the SQL*Loader utility or the UTL_FILE package.
-
Hi ,
We have a catalog that defines 2 types of products (they have too many different properties), so wanted to keep them on two different MDEX engines and serve the applications requests. Here DB catalog and front end ATG application is same for both the MDEX instances.
Is it possible to have 2 different output config XML files and index the data into 2 endeca apps using the same indexing component ProductCatalogSimpleIndexingAdmin?
Thanks
DevHi, also have had some problem some monthes ago - I created separete component ProductCatalogSimpleIndexingAdminSecond. After that one of my colleage gave me some advice:
The creating separate component like ProductCatalogSimpleIndexingAdmin for the second IOC is possible way for resolving your situation. But I afraid that this way will be required creating mane duplicates for already existed components.
In my opinion the better way is the following:
starting from AssemblerApplicationConfiguration and ApplicationConfiguration component. It contains details for connecting between ATG and Endeca. Of course you should configure different components for different Endeca Apps.
After that:
Find all components that uses AssemblerApplicationConfiguration and ApplicationConfiguration. Customize these components for using one or another *Configuration component depending on what index works. (many variants released it: the most simple global custom component with flag.)
Then customize the existed ProductCatalogSimpleIndexingAdmin. Using one or another IOC and setting the flag in global custom component when index started. You can add some methods into your custom ProductCatalogSimpleIndexingAdmin like:
Execute baseline index for both IOC (one by one)
Execute baseline for IOC 1
Execute baseline for IOC 2.
Note: you should be afraid about incremental (partial) index in this configuration. But resolving conflicts in incremental index should be done after full implementation these changes.
Regards -
How to maintain the data into database table
Hi,
experts,
how to maintain the data into database tableThere are several ways to maintain data in the database
1. Use table maintanance generator . You can create this using SE11 and data can be edited through SM30.
2. Loginto SE11 with the specified table and check the ATTRIBUTES tab. There you can set some parameters for maintaining the database. When you set Maintain database, you edit the data thorugh SE11 it self
3. Through Se16 as well.
4. A small abap program can do the above task as well.
Thanks,
Raj
Edited by: Rajanya Kolavennu on Feb 5, 2008 8:33 PM -
(Urgent help needed) how to read txt file and store the data into 2D-array?
Hi, I have a GUI which allow to choose file from the file chooser, and when "Read file" button is pressed, I want to show the array data into the textarea.
The sample data is like this followed:
-0.0007 -0.0061 0.0006
-0.0002 0.0203 0.0066
0 0.2317 0.008
0.0017 0.5957 0.0008
0.0024 1.071 0.0029
0.0439 1.4873 -0.0003
I want my program to scan through and store these data into 2D array.
However for some reason, my source code issues errors, and I don't know what's wrong with it, seems to have a problem in StringTokenizer though. Can anybody help me?
Thanks in advance.
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.StringTokenizer;
public class FileReduction1 extends JFrame implements ActionListener{
// GUI features
private BufferedReader fileInput;
private JTextArea textArea;
private JButton openButton, readButton,processButton,saveButton;
private JTextField textfield;
private JPanel pnlfile;
private JPanel buttonpnl;
private JPanel buttonbar;
// Other fields
private File fileName;
private String[][] data;
private int numLines;
public FileReduction1(String s) {
super(s);
// Content pane
Container cp = getContentPane();
cp.setLayout(new BorderLayout());
// Open button Panel
pnlfile=new JPanel(new BorderLayout());
textfield=new JTextField();
openButton = new JButton("Open File");
openButton.addActionListener(this);
pnlfile.add(openButton,BorderLayout.WEST);
pnlfile.add(textfield,BorderLayout.CENTER);
readButton = new JButton("Read File");
readButton.addActionListener(this);
readButton.setEnabled(false);
pnlfile.add(readButton,BorderLayout.EAST);
cp.add(pnlfile, BorderLayout.NORTH);
// Text area
textArea = new JTextArea(10, 100);
cp.add(new JScrollPane(textArea),BorderLayout.CENTER);
processButton = new JButton("Process");
//processButton.addActionListener(this);
saveButton=new JButton("Save into");
//saveButton.addActionListener(this);
buttonbar=new JPanel(new FlowLayout(FlowLayout.RIGHT));
buttonpnl=new JPanel(new GridLayout(1,0));
buttonpnl.add(processButton);
buttonpnl.add(saveButton);
buttonbar.add(buttonpnl);
cp.add(buttonbar,BorderLayout.SOUTH);
/* ACTION PERFORMED */
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand().equals("Open File")) getFileName();
if (event.getActionCommand().equals("Read File")) readFile();
/* OPEN THE FILE */
private void getFileName() {
// Display file dialog so user can select file to open
JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
int result = fileChooser.showOpenDialog(this);
// If cancel button selected return
if (result == JFileChooser.CANCEL_OPTION) return;
if (result == JFileChooser.APPROVE_OPTION)
fileName = fileChooser.getSelectedFile();
textfield.setText(fileName.getName());
if (checkFileName()) {
openButton.setEnabled(false);
readButton.setEnabled(true);
// Obtain selected file
/* READ FILE */
private void readFile() {
// Disable read button
readButton.setEnabled(false);
// Dimension data structure
getNumberOfLines();
data = new String[numLines][];
// Read file
readTheFile();
// Output to text area
textArea.setText(data[0][0] + "\n");
for(int index=0;index < data.length;index++)
for(int j=1;j<data[index].length;j++)
textArea.append(data[index][j] + "\n");
// Rnable open button
openButton.setEnabled(true);
/* GET NUMBER OF LINES */
/* Get number of lines in file and prepare data structure. */
private void getNumberOfLines() {
int counter = 0;
// Open the file
openFile();
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null) {
counter++;
System.out.println("(" + counter + ") " + line);
line = fileInput.readLine();
numLines = counter;
closeFile();
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile();
System.exit(1);
/* READ FILE */
private void readTheFile() {
// Open the file
int row=0;
int col=0;
openFile();
System.out.println("Read the file");
// Loop through file incrementing counter
try {
String line = fileInput.readLine();
while (line != null)
StringTokenizer st=new StringTokenizer(line);
while(st.hasMoreTokens())
data[row][col]=st.nextToken();
System.out.println(data[row][col]);
col++;
row++;
closeFile();
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error reading File",
"Error 5: ",JOptionPane.ERROR_MESSAGE);
closeFile();
System.exit(1);
/* CHECK FILE NAME */
/* Return flase if selected file is a directory, access is denied or is
not a file name. */
private boolean checkFileName() {
if (fileName.exists()) {
if (fileName.canRead()) {
if (fileName.isFile()) return(true);
else JOptionPane.showMessageDialog(null,
"ERROR 3: File is a directory");
else JOptionPane.showMessageDialog(null,
"ERROR 2: Access denied");
else JOptionPane.showMessageDialog(null,
"ERROR 1: No such file!");
// Return
return(false);
/* FILE HANDLING UTILITIES */
/* OPEN FILE */
private void openFile() {
try {
// Open file
FileReader file = new FileReader(fileName);
fileInput = new BufferedReader(file);
catch(IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File opened");
/* CLOSE FILE */
private void closeFile() {
if (fileInput != null) {
try {
fileInput.close();
catch (IOException ioException) {
JOptionPane.showMessageDialog(this,"Error Opening File",
"Error 4: ",JOptionPane.ERROR_MESSAGE);
System.out.println("File closed");
/* MAIN METHOD */
/* MAIN METHOD */
public static void main(String[] args) throws IOException {
// Create instance of class FileChooser
FileReduction1 newFile = new FileReduction1("File Reduction Program");
// Make window vissible
newFile.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
newFile.setSize(500,400);
newFile.setVisible(true);
Java.lang.NullpointException
at FileReductoin1.readTheFile <FileReduction1.java :172>
at FileReductoin1.readFile <FileReduction1.java :110>
at FileReductoin1.actionPerformed <FileReduction1.java :71>
.1) Next time use the CODE tags. this is way too much unreadable crap.
2) The problem is your String[][] data.... the only place I see you do anything approching initializing it is
data = new String[numLines][];I think you want to do this..
data = new String[numLines][3];anyway that's why it's blowing up on the line
data[row][col]=st.nextToken(); -
Want to Read the a txt file and put the data into the table colums.
I have a text file in which data is piped separated and I want to put the data in the table column.
Eg.
Text File Column
First_name|Last_name|address|phone_number
Database table:
first_name ,last_name,address,phone_number
It's very urgent.
Thanks For your help in advance.
HimanshuUse sqlldr or external file.
See http://download.oracle.com/docs/cd/E11882_01/server.112/e10701/part_ldr.htm#i436326 for SQL Loader.
See http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/tables013.htm#ADMIN11705 for External table. -
Stage tab delimited CSV file and load the data into a different table
Hi,
I pretty new to writing PL/SQL packages.
We are using Application express for our development. We get CSV files which is stored as a BLOB content in a table. I need to write a trigger that would get executed once the user the uploads the file and parse thru the Blob content and upload or stage the data in a different table.
I would like to see if there is any tutorial or article that could explain the above process with the example or sample code to do the same. Any help in this regard will be highly appreciated.Hi,
This is slightly unusual but at the same time easy to solve. You can read through a blob using the dbms_lob package, which is one of the Oracle supplied packages. This is presumably the bit you are missing, as once you know how you read a lob the rest is programming 101.
Alternatively, you could write the lob out to a file on the server using another built in package called utl_file. This file can be parsed using an appropriately defined external table. External tables are the easiest way of reading data from flat files, including csv.
I say unusual because why are you loading a csv file into a blob? A clob is almost understandable but if you can load into a column in a table why not skip this bit and just load the data as it comes in straight into the right table?
All of what I have described is documented functionality, assuming you are on 9i or greater. But you didn't provide a version so I can't provide a link to the documentation ;)
HTH
Chris -
How to read the contents of a text file and populate the data in a table ?
Hello All,
Can anyone advise on how to acheieve the above ? I am trying to read in a text file (CSV) and have the contents populated to the respective UI elements in a table. Any help is greatly appreciated.
from
Kwok WeiHi,
Let us consider you have list of names(Seperated by delimeter) in a text file and you want to display in a table.
1. Create Context Node "Names" and context attribute "Name"
2. Create Table and bind to the above context.
3.Write the following code in the "Init method.
try{
FileReader f =new FileReader("");
BufferedReader r=new BufferedReader(f);
String names=r.readLine();
Vector Names=new Vector();
// Use Tokenizer and store all the names i a vector//
for(int i=0;i<Names.size();i++){
IPrivate<<VieName>>.INameElement ele=wdContext.createNameElement();
ele.set<<Name>>( Names.get(i).toString());
wdContext.NodeName().addElement(ele);
Regards, Anilkumar
Message was edited by: Anilkumar Vippagunta -
Read the file and write the data into string or int
Ok, here's another rookie question.
I got to read the line from the file and store it in the memory as string or integer.
I wrote this code:
File inputFile = new File("c:/xxx.yyy");
String outputString = new String();
FileReader c1 = new FileReader(inputFile);
StringWriter d1 = new StringWriter(outputString);
int data;
while((data = c1.read()) != -1)
d1.write(data);
System.out.println(data);
c1.close();
d1.close();This is how I see it, but it cannot be even compiled because there is no such thing as StringWriter(String) wich I find completely irrational. So tell me, am I retarded or what? No, but seriosly, please help the newbie to understand these streams, am I supposed to use some kind of buffer? Any help appreciated.A String is an immutable. You cannot update a String.
A new String() is basically the same as an empty String ""
An empty StringWriter can be created with new StringWriter().
If you use a BufferedReader you can call readLine().
BufferedReader in = new BufferedReader(new FileReader(filename));
String line;
while((line = in.readLine()) != null) {
System.out.println(line);
} -
How to updated the data into Database table
Hi Guy's,
Please help me Using Tabstrip control how to updated the related infotype records into related database table.
Thanks and Regards,
Sai.Hi Guy's,
Please help me Using Tabstrip control how to updated the related infotype records into related database table.
Thanks and Regards,
Sai. -
How can i read the text files and buffer the data in Vector?
hi. I have been running into this problem for days, but with no luck and losing right direction.
The problem is : I am trying to read a text file and buffer the data into a
Queue for each user.
the sample text file is as below:( 1st column is timestamp, 2nd is user_id, 3rd is packet_id, 4th is packet_seqno, 5th is packet_size)
0 1 1 1 512
1 2 1 2 512
2 3 1 3 512
3 4 1 4 512
4 5 1 5 512
5 6 1 6 512
6 7 1 7 512
7 8 1 8 512
8 9 1 9 512
9 10 1 10 512
10 1 2 11 512
11 2 2 12 512
12 3 2 13 512
13 4 2 14 512
14 5 2 15 512
15 6 2 16 512
16 7 2 17 512
17 8 2 18 512
18 9 2 19 512
19 10 2 20 512
20 1 3 21 512
21 2 3 22 512
22 3 3 23 512
23 4 3 24 512
24 5 3 25 512
25 6 3 26 512
26 7 3 27 512
27 8 3 28 512
28 9 3 29 512
29 10 3 30 512
30 1 4 31 512
31 2 4 32 512
32 3 4 33 512
33 4 4 34 512
34 5 4 35 512
35 6 4 36 512
36 7 4 37 512
37 8 4 38 512
38 9 4 39 512
39 10 4 40 512
40 1 5 41 512
41 2 5 42 512
42 3 5 43 512
43 4 5 44 512
44 5 5 45 512
45 6 5 46 512
46 7 5 47 512
47 8 5 48 512
48 9 5 49 512
49 10 5 50 512
50 1 6 51 512
51 2 6 52 512
52 3 6 53 512
53 4 6 54 512
54 5 6 55 512
55 6 6 56 512
56 7 6 57 512
57 8 6 58 512
58 9 6 59 512
59 10 6 60 512
60 1 7 61 512
61 2 7 62 512
62 3 7 63 512
63 4 7 64 512
64 5 7 65 512
65 6 7 66 512
66 7 7 67 512
67 8 7 68 512
68 9 7 69 512
69 10 7 70 512
70 1 8 71 512
71 2 8 72 512
What I wanna do is to read all the data above and buffer them in a queue for each user( there are only 10 users in total).
I already created a class called Class packet:
public class packet {
private int timestamp;
private int user_id;
private int packet_id;
private int packet_seqno;
private int packet_size;
/** Creates a new instance of packet */
public packet(int timestamp,int user_id, int packet_id,int packet_seqno, int packet_size)
this.timestamp = timestamp;
this.user_id=user_id;
this.packet_id=packet_id;
this.packet_seqno=packet_seqno;
this.packet_size=packet_size;
}then I wanna to create another Class called Class user which I can create a queue for each user (10 users in total) to store type packet information. the queue for each user will be in the order by timestamp.
any idea and sample code will be appreciated.Doesn't sound too hard to me. Your class User (the convention says to capitalize class names) will have an ArrayList or Vector in it to represent the queue, and a method to store a Packet object into the List. An array or ArrayList or Vector will hold the 10 user objects. You will find the right user object from packet.user_id and call the method.
Please try to write some code yourself. You won't learn anything from having someone else write it for you. Look at sample code using ArrayList and Vector, there's plenty out there. Post in the forum again if your code turns out not to behave. -
How to read XML file and update the data in MS CRM 2011?
Hi Folks,
Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
Please let me know if any ways of handling it in simple ways.
Thanks,
SriHI,
How to read XML file:
https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
How to work with CRM:
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService service = (IOrganizationService)proxy;
//using "service" you can create, update and retrieve entities.
More information here about service functions:
https://msdn.microsoft.com/en-us/library/gg328198.aspx -
Hi,
Iam new to the xml,
can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
<?xml version="1.0"?>
<DiseaseCodes>
<Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
</DiseaseCodes>.
Regards,
vikram.here is the your XML parse in 11g :
select *
from xmltable('//Entity' passing xmltype
'<?xml version="1.0"?>
<DiseaseCodes>
<Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
<Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
</DiseaseCodes>
') columns
"dcode" varchar2(4000) path '/Entity/dcode',
"ddesc" varchar2(4000) path '/Entity/ddesc',
"reauthflag" varchar2(4000) path '/Entity/reauthflag'
dcode ddesc reauthflag
0 (I87)Other disorders of veins - postphlebitic syndrome 0
0 (J04)Acute laryngitis and tracheitis 0
0 (J17*)Pneumonia in other diseases - whooping cough 0
SQL>
Using this parser you can create procedure as
SQL> create or replace procedure myXMLParse(x clob) as
2 begin
3 insert into MyXmlTable
4 select *
5 from xmltable('//Entity' passing xmltype(x) columns "dcode"
6 varchar2(4000) path '/Entity/dcode',
7 "ddesc" varchar2(4000) path '/Entity/ddesc',
8 "reauthflag" varchar2(4000) path '/Entity/reauthflag');
9 commit;
10 end;
11
12 /
Procedure created
SQL>
SQL>
SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
PL/SQL procedure successfully completed
SQL> select * from MYXMLTABLE;
dcode ddesc reauthflag
0 (I87)Other disorders of veins - postphlebitic syndrome 0
0 (J04)Acute laryngitis and tracheitis 0
0 (J17*)Pneumonia in other diseases - whooping cough 0
SQL>
SQL>
Ramin Hashimzade -
Shell scripts to read data from a text file and to load it into a table
Hi All,
I have a text file consisting of rows and columns as follows,
GEF001 000093625 MKL002510 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL003604 000001 000000 000000 000000 000000 000000 000001
GEF001 000093625 MKL005675 000001 000000 000000 000000 000000 000000 000001 My requirement is that, i should read the first 3 columns of this file using a shell script and then i have to insert the data into a table consisting of 3 rows in oracle .
the whole application is deployed in unix and that text file comes from mainframe. am working in the unix side of the application and i cant access the data directly from the mainframe. so am required to write a script which reads the data from text file which is placed in certain location and i have to load it to oracle database.
so I can't use SQL * loader.
Please help me something with this...
Thanks in advance.1. Create a dictionary object in Oracle and assign it to the folder where your file resides
2. Write a little procedure which opens the file in the newly created directory object using ULT_FILE and inside the FOR LOOP and do INSERTs to table you want
3. Create a shell script and call that procedure
You can use the post in my Blog for such issues
[Using Oracle UTL_FILE, UTL_SMTP packages and Linux Shell Scripting and Cron utility together|http://kamranagayev.wordpress.com/2009/02/23/using-oracle-utl_file-utl_smtp-packages-and-linux-shell-scripting-and-cron-utility-together-2/]
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Connecting to SQl server ( MS acess front end) and pull the data into BI
Dear all,
i need to extract the data from SQl server ( MS acess front end) and pull the data into BI .
i need to know what are the steps need to follow on this..
can any one help me on this...!
Thanks,
SivaHi,
1. login to sql server u2013 with ur server credentials and connect.
2. select ur sql for ex: sap bw
3. Right click u2013 sapbw - task - export data From sql to excel I m exporting So give sql details
4. Destination u2013 select excel.. and browse where u want to save the fileu2026
5. give next
6. select from which table u want to export
7. click on next
8. click on finish
9. close
10. go to desktop and open the xyz.xls file
11. not make it as csv file and load the data to BI as a flat file
Hope it will help you.
Regards,
Maybe you are looking for
-
While trying to install the new version of iTunes and Quicktime, I get an error while installing: I checked the folder, and the iTunes.msi file is definitely there. When I quit the installer, it said to try the Tools > Download Only option in the app
-
LaserJet Pro 200 M276nw printer connecting directly to an outlet
I received a new printer for my business because the past hp printers broke one me. Tech support told me that I needed to connect the printer directly to an outlet and not use an extension cord or a power surge protector.here's the problem: The desi
-
Integrating CS pages in to existing site
Hi I am working on an existing site, where we want to make available a couple of new pages that are been fed up from the content server. The documents in the cs are been translated correctly to html via the templates we define in Site Builder. Howeve
-
Syncing photos from ipod to computer
I know that you can add photos from the pc to the ipod...but what about the opposite, adding photos TO pc from your ipod? I couldn't figure out how to do that help! This is an ipod touch 4g btw.
-
While following a turorial from pfdScritping I found that the data object "sourceSet" not available in script editor after entering "xfs.", a dropdown menu appears with a list of available objects but does not include sourceSet, can anyone tell me wh