Author |
Message
|
nk |
Posted: Mon Sep 10, 2012 12:19 am Post subject: Storing the csv records, one by one in the database table |
|
|
Novice
Joined: 05 Jul 2012 Posts: 19
|
I've csv file which contains records. I wanna read the record one by one from the csv file and need to store in the database. Here my problem is that how do i'll check for the end of record and put condition in the Esql code |
|
Back to top |
|
 |
kimbert |
Posted: Mon Sep 10, 2012 12:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Two questions:
1. What have you tried so far? No point in us telling you things that you already know
2. Why do you want to do this using ESQL? Is there some reason why the FileInput node does not meet your requirements? |
|
Back to top |
|
 |
nk |
Posted: Tue Sep 11, 2012 1:17 am Post subject: |
|
|
Novice
Joined: 05 Jul 2012 Posts: 19
|
yes there is client requirement to do in ESQl .
Code: |
IF EXISTS(InputRoot.MRM.Rail[]) THEN
INSERT INTO Database.XYZ.Rail ( Key,Org,E_Date,Seq,SegOrg,SegDest,Svc ) VALUES ( Key,Org,E_Date,Seq,SegOrg,SegDest,Svc
);
yes there is client requirement to do in ESQl .
[code]
IF EXISTS(InputRoot.MRM.Rail[]) THEN
INSERT INTO Database.XYZ.Rail ( Key,Org,E_Date,Seq,SegOrg,SegDest,Svc ) VALUES ( Key,Org,E_Date,Seq,SegOrg,SegDest,Svc
);
RETURN FALSE;
END IF;[/code]
The values are getting inserted in the database table but it's not executing anything after the "if". If you remove [code]RETURN FALSE; [/code] all the code will get executed the same number of times of the record length. |
Last edited by nk on Tue Sep 11, 2012 2:23 am; edited 1 time in total |
|
Back to top |
|
 |
kimbert |
Posted: Tue Sep 11, 2012 1:32 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I don't understand how your last post relates to your original question. Please explain more clearly. |
|
Back to top |
|
 |
nk |
Posted: Tue Sep 11, 2012 3:02 am Post subject: |
|
|
Novice
Joined: 05 Jul 2012 Posts: 19
|
I've written the code to store .csv file in the database table. It's now writing but any further code is not getting executed. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Tue Sep 11, 2012 3:09 am Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi nk,
I think you should consider again
clause inside your condition.
--
Marko |
|
Back to top |
|
 |
nathanw |
Posted: Tue Sep 11, 2012 3:14 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
or perhaps have the insert in a separate node and simple propogate each entry as an individual message to the insert node _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
nk |
Posted: Tue Sep 11, 2012 4:25 am Post subject: |
|
|
Novice
Joined: 05 Jul 2012 Posts: 19
|
is the culprit. I've to use only one compute node for the operation.
can i change any additional logic for further code execution or Is there any other method to logic to read from file ? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Sep 11, 2012 4:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
nk wrote: |
Is there any other method to logic to read from file ? |
Yes. Use a FileInput node. Ask the client why they want it done in ESQL; specifically what technical requirement they have & exactly why the FileInput node doesn't meet it.
Or are you looking at a client requirement that says "Produce code to read a csv file" and taking it very, very literally?  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
nk |
Posted: Tue Sep 11, 2012 5:06 am Post subject: |
|
|
Novice
Joined: 05 Jul 2012 Posts: 19
|
I've been provided some doc in which all the req has been nentioned along with the pics of the flow.
My flow goes like this
FTE Input -> Flow Order ->Compute ->Flow Order- > MQ Output
IN the FTE node i need to set custom delimiter(0D0A) so that it takes record one by one. |
|
Back to top |
|
 |
nathanw |
Posted: Tue Sep 11, 2012 5:12 am Post subject: |
|
|
 Knight
Joined: 14 Jul 2004 Posts: 550
|
it is possible to make recomendations to improve the design
personally I would make the improvements and say this is a better solution _________________ Who is General Failure and why is he reading my hard drive?
Artificial Intelligence stands no chance against Natural Stupidity.
Only the User Trace Speaks The Truth  |
|
Back to top |
|
 |
nk |
Posted: Wed Sep 12, 2012 11:50 pm Post subject: |
|
|
Novice
Joined: 05 Jul 2012 Posts: 19
|
thank you all.
we have changed the design . Now it's working. |
|
Back to top |
|
 |
|