Error 'sqlPrepareWithOptions' status='-9' when I insert data item - reporting

I have two data items :
1)
sum(If ([DEV].[STATUS] IN ('Success','Failure'))
THEN ([DEV.[AMT])
ELSE (0))
2)
sum(If ([DEV].[STATUS] IN ('Success','Failure'))
THEN (1)
ELSE (0))
When I try to use the first item in a list cell I get an error 'sqlPrepareWithOptions' status='-9' / group function is not allowed here
The second is working fine in the same scenario.
Thanks!

I set the aggregate function to none. The problem was in my structure. I was adding the data item to list cell under list footer. When I added the item to list cell under list page footer, I was able to run the report successfully.

Related

Get newest date in Sheet

i have a sheet with two tabs. In the first tab, i can select a site and i have a list of types. I have a second tab with many datas from each type (date, year, month week, and site attached to a type).
I would like in the first tab write a formula to automatically get the newest date of the type depending to the selected site.
I'm not good with formulas but i tried to write one, this one =IF((AND(C1=DATA!F:F),(B3=DATA!E:E)),LARGE(DATA!A:A),"") but i don't have result.
Anyone can help me with my problem please ? This is the link of my Sheet.
=INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B3); 1; FALSE);1)
=INDEX(SORT(FILTER( DATA!A:A; DATA!F:F = $C$1; DATA!E:E = $B4); 1; FALSE);1)
INDEX(array, [row])
Index gets the nth value in an array, when you pass in the value 1, it will get the top most value.
I created a sorted array by using the FILTER function. and the SORT function. I sorted it descending and only returned the dates in the FILTER function.

dhtmlxgrid addRow() unusual behavior on checkbox

I am trying to add rows to a grid using dhtmlx in java, following is the code.
var combinedColumn = "displayText";
displayOptionsGrid.addRow(selectedID, [ displayOptionsGrid.getRowsNum() == 0 ? 1 : 0, combinedColumn]);
What the function is supposed to do is that if the number of rows is zero it adds the first row as checked and then the rest as unchecked. The error which I am facing is, I delete the rows one by one and try to re-add the rows in the same session with some other row at first than the row I added previously, but can't. I can only add the row which I added first previously as the first row.
When I use grid.clearAll() it works fine. Can someone tell me the exact thing we do in clearAll() which we don't in deleteSelectedRows() in dhtmlxgrid. Thanks.
Please, check your selectedID attribute.
Note that each row should have a unique id, so adding a row with the id existing in your grid will break the grid.

Clicking on specific row in a WebTable using UFT/QTP

I am having hard time clicking specific row in a Web Table. My code finding proper row, but when I use Child Item method it complains that Object is not found. Here is my code:
Desc = "Record to click"
If Browser("B").Page("P").WebTable("W").exist(10) Then
totalRows = Browser("B").Page("P").WebTable("W").RowCount()
For RowNum = 1 To totalRows
If aDesc = Browser("B").Page("P").WebTable("W").GetCellData(RowNum,2) Then
Browser("B").Page("P").WebTable("W").ChildItem(RowNum,2,"WebElement",0).click
End If
Next
End If
I spied on the value in the row it is Web Element, I tried to use Link- didn't work. Also I tried to Child Item(aDesc,2,"WebElement",0)- didn't work either. I used 0 for the index because there is only one element in the row - simple text. I keep getting this error in many other tests. On rare occasion this approach works in some tests, but most of the time it complains for absence of object.
Thank you very much for your help!
It happened with me as well. When I researched, I found in some of the old HP blogs that ChildItem method does not works correctly with WEBElement, but that was for QTP 9.0, and I was using 12.02.Anyhow, I can't figure out why its happening, and ended up using the following -
Set oExcptnDetail = Description.Create
oExcptnDetail("micclass").value = "WebElement"
oExcptnDetail("html tag").value = "TD"
Set chobj=Browser("").Page("").WebTable("Code").ChildObjects(oExcptnDetail)
chobj(0).Click
On a side note, in order to check a webelement/link exist in a certain row and column, use the following.
Browser("B").Page("P").WebTable("W").ChildItemCount(2,2,"WebElement")
Getcell data will return you anything that is in the desired row and column irrespective of what it is (link,webelement etc) and hence your assumption of if loop will go wrong.
Try this:
Browser("B").Page("P").WebTable("W").object.rows(rownum-1).cells(colnum-1).Click
I was trying to click the first link in my table and this code clicked the item
Set oDesc = Description.Create()
oDesc("html tag").Value = "A"
Set rc = Browser("B").Page("A").WebTable("html id:=gridTable").ChildObjects(oDesc)
rc(0).Click
'num = rc.Count() 'get the number of link in a page
'For i=0 to num-1
'ref = rc(0).GetROProperty("href") 'get the “href”propety of the i th link
'MsgBox ref
'Next
or
Browser("B").Page("A").WebTable("html id:=gridTable").ChildItem(2,8,"Link",0).click
successfully clicks the link I needed

Calculated control displays the total number of records that appear in the subform

My assignment is to create a calculated control that displays to total number of Members in the subform. How can I accomplish this when there is no definitive field that I can use in the expression. There are only three fields in the subform: First Name, Last Name, and Phone. If I do something like this =[frmPlanMemberSubform].[Form]![FirstName] that only calculate and displays the first name of the member in the subform. Actually there are only two names in the subform. Theoretically I suppose to get back a count of 2. But I can't figure out how to do it with the existing fields in the subform. Any Access experts out there? Please help. Here is what the database looks like in form view.
As you can see there is nothing in the Total Members control box.
Follow these steps:
1) In the code of the master form insert a function similar to this:
Private Function NumRecords()
Dim rec As Recordset
On Error GoTo lbErr
Set rec = Me!<subform-name>.Form.RecordsetClone
rec.MoveLast
NumRecords = rec.RecordCount
lbExit:
Exit Function
lbErr:
MsgBox Error, vbExclamation
Resume lbExit
End Function
2) In the field to display the number of records insert the following string in the value property:
=NumRecords()
3) Create the Form_Current trigger as follows:
Private Sub Form_Current()
Me!<fieldname>.Requery
End Sub
enter image description here

Display "No Data" message when table is empty in BIRT Report

I want to hide a table and to report that "No Data" message is present if the query returns no data.
In computed columns i have added the columns which counts the number of rows present(i.e.TableCheck).
and i have created label just below the table with the message "No Data". In script onCreate i have added the below code.
if( countOfRows == 0 ){
this.getStyle().fontStyle = "italic";
this.getStyle().fontSize = "large";
}else{
this.text = "";
}
countOfRows = 0 is initialize in script.
In table visibilty propery, checked the Hide Element and added the below code in expression.
if (row["TableCheck"] == null){
true
}
else{
false
}
Problem: When dataSet is empty "No Data" Message is displaying.But when data set is not empty, then error message is not hiding.
Please let me know how to fix this.
Thanks in Advance.
Do it this way:
First add visual elements to display it when data set doesn't return any row.
Then define global variable in Initialize script of report root.
For example
rowsReturned = 0;
On your table that you'll evaluate data set to see is there rows returned on Visibility tab set next:
On elements you want to display whene there is no returned data set this on Visibility tab
If you want to hide the table when no data returned, you can write this in its Visibility property:
row.__rownum < 0
and in Visibility property of your "No Data" message you use the opposite check:
row.__rownum >= 0
Note that both components must be bound to the data set you want to check. In the case of the message component you can achieve this putting it in a header or footer row.
Alternative solution without using global variables (though functionally not quite the same, because the layout will always contain a table):
Add a binding numRows for the COUNT aggregate with the expression 1 to the table.
Set as visibility expression on the table header row:
!row["numRows"]
Add a new footer row to the table; for this footer row set the visibility expression
row["numRows"]
Merge the cells in this footer row, then place a label "No data found" into the table cell.

Resources