Parker Software Ltd Homepage
Forum Home Forum Home > Email2DB Email Parser > Samples
  New Posts New Posts RSS Feed: CSV process - using repeating items
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

CSV process - using repeating items

 Post Reply Post Reply Page  <12
Author
Message
Daniel View Drop Down
Admin Group
Admin Group
Avatar
Technical Director

Joined: 19 Dec 2006
Location: Stoke-on-Trent
Posts: 881
Post Options Post Options   Quote Daniel Quote  Post ReplyReply Direct Link To This Post Topic: CSV process - using repeating items
    Posted: 17 Aug 2011 at 2:51pm
If you want to ignore X lines from the script, first setup an empty field extraction above the CSV Line extraction, and name it LineCount.
Now, modify the CSV extraction to:
Sub Main()

Dim vbQuote As String
Dim arr As Variant
Dim mod_ans As Integer
vbQuote = Chr(34)
If Val(Fields_value("LineCount")) < 18 Then
Email2DBExtract = ""
End If

If InStr(1, Email2DBExtract, vbQuote) > 0 Then
arr = Split(Email2DBExtract, vbQuote)

For idx = LBound(arr) To UBound(arr)
If idx Mod 2 = 1 Then
arr(idx) = Replace(arr(idx), ",", "[COMMA]")
End If
Next idx

Email2DBExtract = Join(arr, "")
End If

If Left(Email2DBExtract, 1) = "," Then Email2DBExtract = " " & Email2DBExtract
Do While InStr(1, Email2DBExtract, ",,") > 0
Email2DBExtract = Replace(Email2DBExtract, ",,", ", ,")
Loop
Fields_Value("LineCount") = Cstr(Val(Fields_value("LineCount")) + 1)
End Sub
This will send blank data in the pass to for lines up to 18.


Edited by Daniel - 17 Aug 2011 at 5:19pm
Daniel Tallentire
Support
Parker Software
Back to Top
Daniel Horton View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 01 Jun 2009
Location: Stoke-on-Trent
Posts: 315
Post Options Post Options   Quote Daniel Horton Quote  Post ReplyReply Direct Link To This Post Posted: 22 Sep 2014 at 12:30pm
Within Email2DB Version 3 we have made it so that the suggestions in the post are not necessary. There is now a dedicated account type for CSV and Excel files - http://www.email2db.com/help/csvpickup.htm  

Simply use the Process Attachments functionality to place the CSV/Excel file into the directory that Email2DB will be picking up from. That way the account type will deal with the processing of the rows of data for you, and ease your overall configuration of this account. 
Best Regards,

Daniel James Horton
Technical Manager
Parker Software
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down



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