Solved

Parsing data from log file to email body

Posted on 2014-10-31
7
83 Views
Last Modified: 2014-12-01
I am sending out automated emails when certain criterian are met. When I do this I am just sending them in the body of the email a copy of all the data in a captured log file. What I want to do is send them just a specific section of the log file. I have attached an example log file and below is the code I am using to format the email.

MailStatus = SP_DO_MAIL_SEND('usernname@ouremail.COM',MailSubject,LogDir||LogFile,);

Open in new window

ExampleLogFile.Log
0
Comment
Question by:jlcannon
  • 4
  • 2
7 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40418496
I don't recognize the code you are using but would a method that opens the log file, finds "Data I want" (I know that it would not be exactly that text) and extracts it to a string help you?

If so there would need to be some sort of delimiter so that the start of the data you want could be recognized.
0
 

Author Comment

by:jlcannon
ID: 40419353
might work. I was hoping for something more like:
SUBSTRING(Input File FROM '&&&' to '%%%');

Open in new window


and I could add those charactors to the input files and it would give me everything between those charactors. Of course I have tried it and I get nothing.
0
 
LVL 46

Accepted Solution

by:
Martin Liss earned 500 total points
ID: 40419707
It looks like you are trying to use a formula and while my expertise is in VBA rather than formulas, I don't believe there is an Excel SUBSTRING formula. In any case if you are reading the file using VBA and you can make it so the file has delimiters then it's an easy task to extract the data you want.

Given a file that looks like this:
I don't want this part|but I do want this part|but leave this part out of it.

This code will give the middle section.

Dim FF As Integer
Dim strWholeFile As String
Dim strParts() As String

FF = FreeFile
Open "C:/temp/delimited.txt" For Input As FF
strWholeFile = Input$(LOF(FF), FF)
Close

strParts = Split(strWholeFile, "|")

MsgBox strParts(1)

Open in new window

0
ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 46

Expert Comment

by:Martin Liss
ID: 40420368
If the logfile data were in a cell then you could do this. The code assumes the data is in A1 and the part you want winds up in B1.

    Range("A1").TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
        :="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1)), _
        TrailingMinusNumbers:=True

Open in new window

0
 

Author Comment

by:jlcannon
ID: 40421456
I am travelling right now away from my desk so I will definatley give the 2 previous proposed solutions a try when I get back to my project computer.
0
 
LVL 46

Expert Comment

by:Martin Liss
ID: 40473308
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
String manipulation in Visual Basic 7 62
Determine Range to Select 5 48
passing a value with stream reader AFTER a ";" 3 66
Send outlook email from VBS Script 2 29
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question