|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Tue Dec 21, 2010 3:04 pm
Using #DBPUT while reading from a file |
I'm reading lines from a file that look like..
Code: |
9216wo "First=Derek|Last=Taylor|Emp=Crown|09=08"
9216wo "First=Derek|Last=Taylor|Emp=Crown|10=07"
9216wo "First=Derek|Last=Taylor|Emp=Crown|12=07"
9216wo "First=Derek|Last=Taylor|Emp=Crown|13=07"
9216wo "First=Derek|Last=Taylor|Emp=Crown|14=07"
9216wo "First=Derek|Last=Taylor|Emp=Crown|15=07"
9216wo "First=Derek|Last=Taylor|Emp=Crown|16=07" |
then putting them on #DBPUT to try to insert them into a DB. It doesn't work
The first and most major problem is it NEVER pays attention to the rec number.
Is there something Im missing here? |
|
_________________ The Seaworthy |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Dec 21, 2010 3:26 pm |
What is the exact script you are using to try and store it to the DB? What is the name of the database?
|
|
_________________ Asati di tempari! |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Tue Dec 21, 2010 3:35 pm |
name of db is Working
With the file loaded into slot 1 im using...
Code: |
#LOOP 1,50 {#DBPUT %read(1,%i)} |
I've used several variations of this to try to get it to work, but it seems something just this simple should do it. The lines are in the correct format according to the help file. I've verified that the lines are reading correctly using #SHOW and other things, so narrowed it down to just the #DBPUT not working correctly. |
|
_________________ The Seaworthy |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Dec 21, 2010 3:54 pm |
I think #DBPUT is seeing the %read() output as a single string, and thus a single value. You need to split the %read() ouput into pieces.
|
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Tue Dec 21, 2010 3:57 pm |
I tried that.
I did
Code: |
#LOOP 1,50 {#IF (%read(1,%i) =~ "^((%d)wo) (%x)") {#DBPUT %pat(1) %pat(3)}} |
I even tried splitting %pat(3) out into different parts and then using %concat to tie it back together again, no go. |
|
_________________ The Seaworthy |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Tue Dec 21, 2010 8:40 pm |
Anyone got anything? I used some SQL statements to maneuver around this whole issue but still it should have worked.
|
|
_________________ The Seaworthy |
|
|
|
|
|