Parker Software Ltd Homepage
Forum Home Forum Home > Email2DB Email Parser > Scripting > Scripting Samples
  New Posts New Posts RSS Feed: Updating DB Via Script
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Updating DB Via Script

 Post Reply Post Reply Page  <123>
Author
Message
swhiteman View Drop Down
Expert
Expert


Joined: 13 Mar 2008
Location: NYNY
Posts: 258
Post Options Post Options   Quote swhiteman Quote  Post ReplyReply Direct Link To This Post Topic: Updating DB Via Script
    Posted: 25 May 2011 at 1:48am
What happens if you do an AddToLog(FIELDS_Value("fieldname")) in your script -- this should output to the Email2DB console and is crucial for debugging.

Is there anything particular about the type of data being appended vs. those that don't append?  an you tell me more about how you're extracting each piece of data, sample values?

Again, the Additional Actions should occur after all fields are populated.
Back to Top
wa1sov View Drop Down
New User
New User


Joined: 22 May 2011
Location: USA
Posts: 15
Post Options Post Options   Quote wa1sov Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2011 at 2:53am
Well according to the log the estraction process from the email ocurrs first and then the Additional Action ocurrs but the first CSV file does not appear to close until after teh additional action script executes. The other funny thing here is that the file name does not show up in the log from the additional actions script.
 
Print #1,FIELDS_Value("fielddata1");",";FIELDS_Value("fielddata2");",";FIELDS_Value("fielddata3");",";FIELDS_Value("fielddata4");",";FIELDS_Value("fielddata5");",";FIELDS_Value("fielddata6");",";FIELDS_Value("fielddata7");",";FIELDS_Value("fielddata8");",";FIELDS_Value("fielddata9");",";FIELDS_Value("fielddata10");",";FIELDS_Value("fielddata11");",";FIELDS_Value("fielddata12");",";FIELDS_Value("fielddata13");",";FIELDS_Value("fielddata14");",";FIELDS_Value("fielddata15")
 
"fielddata14" and
"fielddata15" are calulated fields during the email extraction process.
 
fielddata1, fielddata2, fielddata3, fielddata4, fielddata8, fielddata13 do not append
 
I don't see anything different in the syntax above. What do you think?
 
Tongue
 
Back to Top
swhiteman View Drop Down
Expert
Expert


Joined: 13 Mar 2008
Location: NYNY
Posts: 258
Post Options Post Options   Quote swhiteman Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2011 at 3:18am
Are you sending the file name to the log with AddToLog()? Otherwise there's no reason to expect it to display.

Can you give me sample data from a field that appends, and another that does not append?  Have you added AddToLog(FIELDS_Value("fielddata13")) to the script to see if it prints to the log, if not to the CSV?


Back to Top
wa1sov View Drop Down
New User
New User


Joined: 22 May 2011
Location: USA
Posts: 15
Post Options Post Options   Quote wa1sov Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2011 at 4:04am
NO I put the CSV filename inside the brackets. I will try the log addition to see if it is appending the fields that it is not currently appending. Good idea! Thanks I'll get back to You
Back to Top
swhiteman View Drop Down
Expert
Expert


Joined: 13 Mar 2008
Location: NYNY
Posts: 258
Post Options Post Options   Quote swhiteman Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2011 at 11:37pm
I put the CSV filename inside the brackets
Don't actually know what you meant by that -- but in any case use AddToLog to debug the script at runtime.
Back to Top
wa1sov View Drop Down
New User
New User


Joined: 22 May 2011
Location: USA
Posts: 15
Post Options Post Options   Quote wa1sov Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2011 at 12:20pm
Yea, I set up a second database file and tried to append to that as you suggested and the same fields are not updated. In addition I placed a Call AddToLog with the file name to see where it was executing in the sequence and it looks like it is correct. No matter what I do I cannot seem to get these particular fields to append. There doesn't seem to be anything different in the syntax of the Print statement and there is nothing special about these fields.
 
Thanks
Pete
Back to Top
wa1sov View Drop Down
New User
New User


Joined: 22 May 2011
Location: USA
Posts: 15
Post Options Post Options   Quote wa1sov Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2011 at 12:41pm
Ok I solved the missing field problem. One needs to watch those underscores so I used the log to debug the problem as you had suggested and found the field name was slightly different by the underscore between words. Now on to the next challenge.
 
Thanks
Pete
Back to Top
wa1sov View Drop Down
New User
New User


Joined: 22 May 2011
Location: USA
Posts: 15
Post Options Post Options   Quote wa1sov Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2011 at 4:04pm
So, I am trying to update one of the fields with a calculated value in the print statement. It does not update this value. I am afraid I don't understand the syntax of this statement. It only wants to copy the fileds not allow an update as the For Next Loop iterates. If I want one of the fields in the append statement to update each record from within the For Next loop and the append statement, what syntax do I use. The value of the fielddata I am updating is iterating within the loop. I can see it in the the log data but I cannot seem to assign the value to the filedvalue in the print statement as the others are done. It only copies the fieldvalue and does not assign the new value every time the loop iterates. Any other ideas?
 
Thanks
Pete
Back to Top
swhiteman View Drop Down
Expert
Expert


Joined: 13 Mar 2008
Location: NYNY
Posts: 258
Post Options Post Options   Quote swhiteman Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2011 at 6:01pm
Post your code -- there's no way I could tell where a subtle syntax error is occurring without looking at it.
Back to Top
wa1sov View Drop Down
New User
New User


Joined: 22 May 2011
Location: USA
Posts: 15
Post Options Post Options   Quote wa1sov Quote  Post ReplyReply Direct Link To This Post Posted: 30 May 2011 at 11:40pm
As it turns out, I found that if I assigned the loop counter value instead of the Fielddata value I was trying to insert in the append statement, the whole thing works. The fielddata value I was using in the print statement for one field would not update, but if I changed it to the loop counter value that was iterating (i) then all was well. It may have something to do with the fact that this particular  fielddata value was a calculated value from other data in the database, though it isn't clear to me why. Do you know if there is an after market reference book written about EMAIL2DB? I don't know how popular the program is but it is powerful and warrants a book of reference material. Thanks for all your help. Without your assitance I would have still been struggling but your help has allowed me to get a simple script running now.
 
Best Regards
Pete
Back to Top
 Post Reply Post Reply Page  <123>

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.148 seconds.
These are the forums for Parker Software, developers of Live Chat Software: WhosOn and Email Automation Software: Email2DB.