Parker Software Ltd Homepage
Forum Home Forum Home > ThinkAutomation Business Process Automation > Samples
  New Posts New Posts RSS Feed - CSV process - using repeating items
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CSV process - using repeating items

 Post Reply Post Reply Page  12>
Author
Message Reverse Sort Order
parkersoft-nick View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 28 Dec 2015
Location: UK
Points: 121
Post Options Post Options   Thanks (0) Thanks(0)   Quote parkersoft-nick Quote  Post ReplyReply Direct Link To This Post Topic: CSV process - using repeating items
    Posted: 08 Jun 2016 at 11:11am
Hi Nexent1!

Thanks for the positive vibes! Glad you're enjoying the product :)

All the best,
Nick
Back to Top
Nexent1 View Drop Down
New User
New User
Avatar

Joined: 24 Jun 2010
Location: Mississauga
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nexent1 Quote  Post ReplyReply Direct Link To This Post Posted: 30 Dec 2015 at 4:28pm
This is a great posting. Just want to say what a great job you are doing. This post provides so many insights in to what is possible.

Thank you for the great help.
Back to Top
Daniel Horton View Drop Down
Admin Group
Admin Group
Avatar
Technical Support

Joined: 01 Jun 2009
Location: Stoke-on-Trent
Points: 346
Post Options Post Options   Thanks (0) Thanks(0)   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
Daniel View Drop Down
Admin Group
Admin Group
Avatar
Technical Director

Joined: 19 Dec 2006
Location: Stoke-on-Trent
Points: 881
Post Options Post Options   Thanks (0) Thanks(0)   Quote Daniel Quote  Post ReplyReply Direct Link To This Post 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 View Drop Down
Admin Group
Admin Group
Avatar
Technical Director

Joined: 19 Dec 2006
Location: Stoke-on-Trent
Points: 881
Post Options Post Options   Thanks (0) Thanks(0)   Quote Daniel Quote  Post ReplyReply Direct Link To This Post Posted: 17 Aug 2011 at 10:47am
If you want to extract a maximum of 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
       Email2DBTrigger = False
    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 cancel the trigger once the execution reaches the linecount, so no more messages would be passed through.


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
Points: 346
Post Options Post Options   Thanks (0) Thanks(0)   Quote Daniel Horton Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jun 2011 at 5:36pm
If you are expecting multiple blank items within a row of data then please use the following script in your CSVLine trigger:


Sub Main()

    Dim vbQuote As String
    Dim arr As Variant
    Dim mod_ans As Integer
    vbQuote = Chr(34)

    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
End Sub

Best Regards,

Daniel James Horton
Technical Manager
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
Points: 346
Post Options Post Options   Thanks (0) Thanks(0)   Quote Daniel Horton Quote  Post ReplyReply Direct Link To This Post Posted: 12 Aug 2010 at 10:54am
Hi Brian,

Thanks for contacting support@parker-software.com. We shall resume communication via email for the time being and if I find your problem I will update both this and contact you via email.
Best Regards,

Daniel James Horton
Technical Manager
Parker Software
Back to Top
Webtrix View Drop Down
New User
New User


Joined: 10 Aug 2010
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote Webtrix Quote  Post ReplyReply Direct Link To This Post Posted: 11 Aug 2010 at 12:43am
I am having some trouble doing this. I followed this step by step, but it does not work for me. When i use the "Run Test" feature everything works smoothly however when i email it from an outside source, the data from my csv file is not getting passed from the email to the triggers. any help would be greatly appreciated.
Back to Top
Daniel View Drop Down
Admin Group
Admin Group
Avatar
Technical Director

Joined: 19 Dec 2006
Location: Stoke-on-Trent
Points: 881
Post Options Post Options   Thanks (0) Thanks(0)   Quote Daniel Quote  Post ReplyReply Direct Link To This Post Posted: 06 Mar 2009 at 12:46pm
Hi Mitesh,

You should use a regular expression to grab the block (this sort of block are the least easy to do).

Look for should be
Service : [A-Za-z]*[\r\n]+[A-Za-z0-9 ]*[\r\n]+[A-Za-z0-9 ]*[\r\n]+[A-Za-z0-9. ]*


Then the 2nd tab should have "use the find mask" checked.
Daniel Tallentire
Support
Parker Software
Back to Top
mitesh281 View Drop Down
Professional
Professional
Avatar

Joined: 24 Feb 2009
Location: India
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote mitesh281 Quote  Post ReplyReply Direct Link To This Post Posted: 03 Mar 2009 at 1:14pm
Hi Daniel,
 
I am trying to use repeating block feature for below formate of email.
 
Client Name : Test
Client Type : Test1
Layer Name : Test
 Service : NONE
 Test : Yes
 Description : Test1
 Last Measure : 1.0 Mins
 Service : NONE
 Test : No
 Description : Test2
 Last Measure : 4.0 Mins
Priority : Critical
Start Time : Feb 01, 2009 01:31:56
 
Can you please guide me on this?
 
Thanks.
Back to Top
 Post Reply Post Reply Page  12>
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.05
Copyright ©2001-2016 Web Wiz Ltd.

This page was generated in 0.063 seconds.