Saturday, September 28, 2013

Crystal Reports interview Questions

1. What is Crystal Report?
Ans: Crystal report is a report generation tool. Generally have interface with VB6. Crystal report basically generates dynamic data. You can format the data in whichever way you feel like.
2. Can we use Crystal report as a stand-alone application?
Ans:Generally we use Crystal Reports with VB6. However we can make crystal report stand-alone application also. But for that limitation is for viewing the report user should have crystal reports installed on his/her PC.
3. How do we connect to the database?
Ans: There are two ways of creating the report: -
Use crystal report built in query.
Use the tool ‘ Crystal SQL Designer’ provided by crystal report.
When you create report using crystal report built in query then it asks for the data source name that you have created. When you run the report, then for the first time it will ask for the user id and password. After that it will store the same.
When you create ‘.qry’ using ‘Crystal SQL’ Designer then at that time it will ask for the user id and password. When you run the report for the first time instead of asking for the user id and password it will ask for the ‘.qry’ file location. You can change the query location also. For that open the report, select ‘Set Location’ option in Database menu item, and set the location.
4. How do we format field?
Ans:For formatting any field just right click on it and you will get many options like ‘Format Field.’ ‘Browse field data’ etc. Click on ‘Format Field.’ You can align data, suppress, make it multiline, change the font size, style, and type, make it hyperlink etc.
If it is an amount field then you can display currency symbol also. Right click on the field select ‘Format Field’.
5. Can we give parameters to the report?
Ans:We can very well give parameters to the report. For creating parameters select ‘Parameter Field’ in Insert menu item. ‘Create Parameter Field’ dialog box will popped up, it will ask for the name of parameter, prompting text and datatype. Now when you run the report it will prompt for these parameters.
6.Can we create our own formulas in reports?
Ans:We can create our own formulas in reports. Select ‘Formula Field’ in Insert menu item. Write the formula in ‘Formula Editor’. Here you will get ‘Field Tree’, ‘Function Tree’, and ‘Operator Tree’, which will display the report fields, functions that are supported by crystal reports (like CDATE () etc.), operators (arithmetic, strings etc.) respectively.
7. Can we create report using more than one database?
Ans:We can create report using more than one database like Oracle, Access. Create data source name for both the databases. Select tables from them and create the report.
Only restriction is if you use two databases then you cannot see the SQL generated by crystal reports.
8. Can we export data of reports into other format like in world doc etc?
Ans:Generated data can be exported to word doc, or in rich text format. Just click on ‘Export’ icon in the menu. Export dialog box will be popped up. It will ask for the ‘Format’ like comma-separated value (csv) etc and the ‘Destination’ like disk, application etc. After that it will ask for the file name and save the data.
Only restriction is formatting of data will be lost, but crystal report will try to maintain as much formatting as it can.
9. Can we use our own SQL for creating a report?
Ans:We can also make our own query using ‘Crystal SQL Designer’ tool provided by SQL. Here you can insert your SQL statement as such. It will save this file as ‘.qry’ . And when you create a report instead of using ‘Database’ button use ‘Crystal SQL Statement’ button.
10. Can we edit SQL made by Crystal reports?
Ans:We cannot edit the SQL made by crystal reports. However we can view the SQL. For that select ‘Show SQL Query’ in Database menu item. Limitation is if you are using only one database. If you use two databases then you can’t even view the SQL prepared by crystal report.
11. Are there any limitations in crystal reports?
Ans: There are certain limitations in crystal reports. They are: -
If database is having field whose length is more than 255 characters, then you cannot make formula using that field.
While exporting data formatting is lost.
When you browse data just by right clicking on the field then it displays that is there in the database not the data selected by the query.
12. Can we suppress printing in crystal reports if 0 records are fetched?
Ans:Yes, we can suppress printing if no records are fetched. Select ‘Report Options’ in File menu item. ‘Report Options’ dialog box will pop up. In that there is one option ‘ Suppress printing if no records’ Check this option. If no records are found then nothing will be printed on the report.

13. What are the sections that we have in Crystal reports?

Ans: Report has got standard sections like ‘Page Header’, ‘Page Footer’, ‘Report Header’, ‘Report Footer’, and ‘Details’.
However you can add other sections also. Select ‘Sections’ in the Insert menu item. You can insert group sections also.
If you don’t want to show any section just right click on that section and suppress that.
14. Can we add any database field once we have chosen ‘Close’ button?
Ans: Yes, we can add any database field afterwards also. Select ‘Database Field’ in Insert menu item.
If you are using crystal report built in query then it will display the tables that you have selected. And you can select whichever field you want to display on the report.
But if you are using ‘.qry’ file then it will display Query and you can select only those field, which are there in the query.
15. Does Crystal Report support all the functions that we have in Oracle?
Ans:No, Crystal report does not support all the functions. Like Decode function is there in SQL but not there is crystal report. You need to convert that in crystal report format (in if and else etc.).
However if you use ‘.qry’ files then it take the SQL as such. There is no need of changing any syntax.
16. Can we use stored procedure for creating the report?
Ans: Yes, we can use stored procedure.
17. Is there any feature like summing total in crystal report?
Ans:Crystal reports provide features like grand total, sub-total, running total etc. You can select any of these features in Insert menu item.
You can sum up records on the basis of each record or on change of group using ‘Running Total ‘ option in Insert menu item.
18. I am using two tables one is of access database and other is of oracle database, I am getting an error saying that ‘SQL odbc error’ what should I do?
Ans:If you are getting such an error then click the icon for ‘Report Expert’. It will give a warning saying that formatting will be lost. Ignore this you will get ‘Standard Report Expert’ dialog box. Reverse the links of access database table and it will work.

Sunday, December 19, 2010

Link for Google Map Integration dynamically.

http://webcodeblog.com/2010/04/22/setting-up-google-maps-for-asp-net-and-sql-server/

Friday, December 10, 2010

Code for Export to Excel sheet in vb.net

Public Shared Function CreateExcelFile(ByVal fileName As String, ByVal dt As DataTable) As Boolean
Dim excelExport As New Microsoft.Office.Interop.Excel.Application()
Dim excelBook As Microsoft.Office.Interop.Excel.Workbook
Dim excelSheets As Microsoft.Office.Interop.Excel.Sheets
Dim excelSheet As Microsoft.Office.Interop.Excel.Worksheet
Dim excelCells As Microsoft.Office.Interop.Excel.Range
Dim location As Integer = System.Windows.Forms.Application.ExecutablePath.LastIndexOf("\")
'Dim exPath As String = System.Windows.Forms.Application.ExecutablePath
Dim filePath As String
Try
'If Not isInstalled(ApiEnums.OfficeApplications.Excel) Then
' MsgBox("Microsoft Excel is required for this functionality." & vbCrLf & _
' "Contact your Help Desk about getting " & vbCrLf & "this installed. Thank You.")
'Else
filePath = "C:\" & fileName
'If Not Directory.Exists(exPath.Substring(0, (location + 1)) + "tmpFiles\") Then
' Directory.CreateDirectory(exPath.Substring(0, (location + 1)) + "tmpFiles\")
'End If
excelExport.Visible = False : excelExport.DisplayAlerts = False
excelBook = excelExport.Workbooks.Add
excelSheets = excelBook.Worksheets
excelSheet = CType(excelSheets.Item(1), Microsoft.Office.Interop.Excel.Worksheet)
excelSheet.Name = "YourSheetName - " & Date.Now.Day & Date.Now.ToString("MMM") & Date.Now.ToString("yy")

excelCells = excelSheet.Cells
' excelCells.Font.Bold = True
PopulateSheet(dt, excelCells)

excelBook.SaveAs(filePath)
excelBook.Close()
excelExport.Quit()

ReleaseComObject(excelCells) : ReleaseComObject(excelSheet)

ReleaseComObject(excelSheets)
ReleaseComObject(excelBook) : ReleaseComObject(excelExport)

excelExport = Nothing : excelBook = Nothing : excelSheets = Nothing
excelSheet = Nothing : excelCells = Nothing

System.GC.Collect()
Return True
'End If
Catch ex As Exception
MsgBox(ex.Message, "Error exporting data")
Return False
End Try
End Function
Private Shared Sub PopulateSheet(ByVal dt As System.Data.DataTable, ByVal oCells As Microsoft.Office.Interop.Excel.Range)
Dim dRow As DataRow
Dim dataArray() As Object
Dim count As Integer
Dim column_count As Integer
'Output Column Headers

Dim Id As String = String.Empty
Dim mId As String = String.Empty
Id = dt.Columns(0).ColumnName & dt.Rows(0).Item("Id")
mId = dt.Columns(1).ColumnName & dt.Rows(0).Item("MatterIdString")
dt.Columns.RemoveAt(0)
dt.Columns.RemoveAt(0)
For column_count = 0 To dt.Columns.Count - 1
'oCells(4, 4) = " Kimmel and Silverman, P.C." & Environment.NewLine & "All Time for Selected File:" & Environment.NewLine & "Doll, Patricia v. Collection Specialists, Inc." & Environment.NewLine & clientId & Environment.NewLine & mId
oCells(1, 3) = "Kimmel and Silverman, P.C"

oCells(2, 3) = "All Time for Selected File:"
oCells(3, 3) = "Doll, Patricia v. Collection Specialists, Inc."

oCells(4, 3) = Id
oCells(5, 3) = mId
oCells(7, column_count + 1) = dt.Columns(column_count).ToString
'With oCells.Range(5, column_count + 1)
' .Font.Bold = True
'End With

With oCells(2, 3)
.Font.Bold = True

End With
With oCells(3, 3)
.Font.Bold = True
End With
With oCells(7, 1)
.Font.Bold = True
End With
With oCells(7, 2)
.Font.Bold = True
End With
With oCells(7, 3)
.Font.Bold = True
.WrapText = True
.EntireColumn.AutoFit()

End With
With oCells(7, 4)
.Font.Bold = True
End With
With oCells(7, 5)
.Font.Bold = True
End With
With oCells(7, 6)
.Font.Bold = True
End With
Next
'Output Data
For count = 0 To dt.Rows.Count - 1
dRow = dt.Rows.Item(count)

dataArray = dRow.ItemArray
For column_count = 0 To UBound(dataArray)
oCells(count + 8, column_count + 1) = dataArray(column_count).ToString

If (column_count + 1 = 3) Then

With oCells(count + 8, column_count + 1)
.WrapText = True

End With

End If
If (column_count + 1 = 4) Then
Dim Duration As Integer
Duration = dataArray(column_count).ToString()
Dim ts As New TimeSpan(0, 0, Duration)
Dim hrs As Double = 0.0
hrs = ts.Hours + (ts.Minutes / 60) + (ts.Seconds / 360)
oCells(count + 8, column_count + 1) = hrs

End If
Next
Next
End Sub

Friday, April 9, 2010

Bug Report

Roles and Responsibilities of "Software Test Engineer"

1) Analyzing the Requirements from the client
2) Participating in preparing Test Plans
3) Preparing Test Scenarios
4) Preparing Test Cases for module, integration and system testing
5) Preparing Test Data’s for the test cases
6) Preparing Test Environment to execute the test cases
7) Analyzing the Test Cases prepared by other team members
8) Executing the Test Cases
9) Defect Tracking
10) Giving mandatory information of a defect to developers in order to fix it
11) Preparing Summary Reports
12) Preparing Lesson Learnt documents from the previous project testing experience
13) Preparing Suggestion Documents to improve the quality of the application
14) Communication with the Test Lead / Test Manager
15) Conducting Review Meetings within the Team

These are the Roles and Responsibilities of a Testing Engineer which is based upon my knowledge. If you know more about this kindly write it down in the comments section.
Your Feed backs are welcome!

Wednesday, April 7, 2010