Actuateclub.com

 

  About Actuate   |   Forums   |   Message Board  |   FAQ   |   Jobs    |   Actuate 100   |   Guest Book  |   Feedback  |   Sitemap   |   Home

Techieindex

 
Writing OutPut To Text file

Description :
 
Some times users has to get the data to their own formats. They want the data to be in flat files and work on the flat file later, like convert the data to excel sheet, then make graphs , etc…

Report Logic :

First we need to open the text file for output, the coding is done in start method of report section acreport.
Sample Code :

Sub Start( )
 Super::Start( )

 Dim wkday As Integer
 wkday = Weekday(Date$())
 Select Case wkday
    Case 1
      WStartDate = DateAdd("d",-7, Date$())
     WEndDate = DateAdd("d",-1, Date$()) & " 23:59:59"
    Case 2
     WStartDate = DateAdd("d",-8, Date$())
     WEndDate = DateAdd("d",-2, Date$()) & " 23:59:59"
    Case 3
      WStartDate = DateAdd("d",-9, Date$())
     WEndDate = DateAdd("d",-3, Date$()) & " 23:59:59"
   Case 4
     WStartDate = DateAdd("d",-10, Date$())
     WEndDate = DateAdd("d",-4, Date$()) & " 23:59:59"
   Case 5
     WStartDate = DateAdd("d",-11, Date$())
     WEndDate = DateAdd("d",-5, Date$()) & " 23:59:59"
   Case 6
      WStartDate = DateAdd("d",-12, Date$())
      WEndDate = DateAdd("d",-6, Date$()) & " 23:59:59"
   Case 7
      WStartDate = DateAdd("d",-13, Date$())
      WEndDate = DateAdd("d",-7, Date$()) & " 23:59:59"
End Select
WStartDate = UCase$(Format$(WStartDate,"DD-MMM-YYYY       HH:NN:SS"))   
WEndDate = UCase$(Format$(WEndDate,"DD-MMM-YYYY HH:NN:SS"))
DataFile = "C:\Sachin\Bmc\NewReports\WeeklyEscalations.txt"
DataChannel = FreeFile()
Open DataFile For Output As DataChannel

 End Sub


'Code in the frame finish method, for making the output to Comma separated file.

  Sub Finish( )
  Super::Finish( )

  Dim strFieldText, strTextFile As String
  Dim delim As String
  Dim theControl As AcControl

  delim = ","

  Set theControl = FindContentByClass("SBUName")
  strFieldText = CStr(theControl.GetValue) & delim
  strTextFile = strTextFile & strFieldText

  Set theControl = FindContentByClass("CasesResolvedLastWeek")
  strFieldText = CStr(theControl.GetValue) & delim
  strTextFile = strTextFile & strFieldText

  Set theControl = FindContentByClass("CasesResolvedByTechSupport")
  strFieldText = CStr(theControl.GetValue) & delim
  strTextFile = strTextFile & strFieldText

  Set theControl = FindContentByClass("CasesResolvedByDevelopment")
  strFieldText = CStr(theControl.GetValue)
  strTextFile = strTextFile & strFieldText

  Print #DataChannel, strTextFile
  End Sub

 

 

 

Copyright © 2008 Techieindex