Support Center

Sample app for display fax logs using querylog syntax

Gueipin Feb 22, 2012 04:46AM EST

Hi,

Please post a sample code snippet showing how to query the fax logs, say, according to SentDate field in a certain date range.

I have gone through the documentation, but could not find a good sample.

Thanks!

5 Data Techniques Responses and 5 Community Responses

Up 3 Rated Down
DTI Support  Data Techniques Employee Feb 22, 2012 09:03AM EST

Hi,

Here's a query statement that will return all faxes that were sent between a set of dates:


SentDate > strftime('%s','2011-03-01') and SentDate < strftime('%s','2011-05-01')

That would return all faxes between 03-01-2011 and 05-01-2011

Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 2 Rated Down
Gueipin  Data Techniques Employee Feb 23, 2012 02:21AM EST

Hi Sean,

I am using VB.Net in VS2010. Where do I put the line as provided in your post? Please check the following code snippet:

Dim currentLog As FaxLog
If cmbLogType.Text = "Fax Out Completed" Then
if chkBoxAll.Value=1 then
currentLog = FaxLog.Complete
else
currentLog = FaxMan1.QueryLog("SentDate>strftime('%s','2012-02-21')")
end if
ElseIf cmbLogType.Text = "Fax Out Failed" Then
currentLog = FaxLog.Failed
ElseIf cmbLogType.Text = "Fax Out Pending" Then
currentLog = FaxLog.Pending
ElseIf cmbLogType.Text = "Fax In/Received" Then
currentLog = FaxLog.Received
Else
currentLog = FaxLog.Complete
End If
SetCurrentLog(currentLog)

FaxMan1.querylog is not a valid line the way I coded.

Thanks again.

Up 4 Rated Down
DTI Support  Data Techniques Employee Feb 23, 2012 09:42AM EST

Hello,

The following code works to query the faxman log:

Dim l As Log = faxMan1.QueryLog("SentDate > strftime('%s','2012-02-17') and FaxId > 15")

For Each fx As Fax In l
Console.WriteLine("Date = {0}, File = {1}", fx.SentDateTime, fx.Files)
Next fx

You didnt really say what your error was only that it didnt work. If you still have an issue please try to be specific as to whats happening.

Thanks,
Sean

Up 2 Rated Down
Gueipin  Data Techniques Employee Feb 24, 2012 02:43AM EST

The error is:

Value of Type 'DataTech.FaxManNet.Log' can not be converted to 'DataTech.FaxManNet.Log'

becase currentLog is dimmed as FaxLog, while FaxMan1.QueryLog returns as Log, not FaxLog.

There must be a way to do the conversion. Please advise. Thanks again.

Up 3 Rated Down
Gueipin  Data Techniques Employee Feb 24, 2012 03:50AM EST

Sorry, I meant to write:

Value of Type 'DataTech.FaxManNet.Log' can not be converted to 'DataTech.FaxManNet.FaxLog'

My bad.

Up -4 Rated Down
DTI Support  Data Techniques Employee Feb 24, 2012 08:33AM EST

HI,

FaxLog is an enumeration, you need to use the object Log. Your code should be:

Dim currentLog As Log ' Not FAXLOG

If cmbLogType.Text = "Fax Out Completed" Then
if chkBoxAll.Value=1 then
currentLog = FaxLog.Complete
else
currentLog = FaxMan1.QueryLog("SentDate>strftime('%s','2012-02-21')")
end if
ElseIf cmbLogType.Text = "Fax Out Failed" Then
currentLog = FaxLog.Failed
ElseIf cmbLogType.Text = "Fax Out Pending" Then
currentLog = FaxLog.Pending
ElseIf cmbLogType.Text = "Fax In/Received" Then
currentLog = FaxLog.Received
Else
currentLog = FaxLog.Complete
End If
SetCurrentLog(currentLog)
Thanks for your interest in our products and please let us know if you have any questions.

Sincerely,
Sean
Data Techniques Support

Up 3 Rated Down
Gueipin  Data Techniques Employee Feb 24, 2012 12:07PM EST

Have you tried your code in Vb.net? It won't work. The error is that you can not mix Log with Faxlog, the same problem we are talking about here. When currentLog is assigned with FaxLog.Complete, or any other, the error resulted.

Thanks.

Up 2 Rated Down
DTI Support  Data Techniques Employee Feb 24, 2012 12:26PM EST

HI,
.
Right, the QueryLog returns a Log collection object. Here's some simple code to do what you want:

Dim l as Log

Switch ( Type of Log You want )

case Failed:
l = Faxman.FailedLog


case Completed:
l = FaxMan.CompletedLog

case CustomQuery:
l = Faxman.QueryLog("your query here")

End

The you can process the log collection which is in the variable 'l'.

Sean

Up 2 Rated Down
Gueipin  Data Techniques Employee Feb 24, 2012 01:24PM EST

Excellent!

One of the reasons why customers come back to you again and again is because your support is so consistent and of high quality. This is a perfect example.

Keep up with all the great work you have been doing!

Thanks again.

Up 3 Rated Down
DTI Support  Data Techniques Employee Feb 24, 2012 01:25PM EST

Hi,

Thanks and you're welcome.

Have a great weekend and let us know if you have any other questions.

Sean

This question is closed to new answers.

Contact Us