How to set checkboxes in grid
Question ID: 104956
0
0

Using VBScript I want to be able to set a checkbox in a row of a grid. I have existing code that works when there is only one checkbox in the row. The new code will be dealing with a grid that has two check boxes (each in its own colum) in each row.

I steps through and captured the steps to perform the action manually. Listed below are the steps I can’t get to work.

SwfWindow("SITU CU – CUBE Setup |").SwfWindow("Select Qualifying/Disqualifyin").SwfTable("savingsCheckingQualifyingUltra").ActivateRow "33"
SwfWindow("SITU CU – CUBE Setup |").SwfWindow("Select Qualifying/Disqualifyin").SwfTable("savingsCheckingQualifyingUltra").ActivateCell "33","Qualifying"
SwfWindow("SITU CU – CUBE Setup |").SwfWindow("Select Qualifying/Disqualifyin").SwfTable("savingsCheckingQualifyingUltra").SetCellData "33","Qualifying","True"

Here is the Function that works for a grid with one checkbox per row. strInputValue has Row:1 (the row nnumber in the grid that I want to set the checkbox in. strObjectName contains the name of the grid. "Select" is the name of the checkbox. As I stated this one works:

‘**************************************************************

Function TableCheckBoxSelect(strInputValue, strObjectName)

Dim MyTest
MyTest = split (strInputValue,":")
Set objSub = SwfWindow("swfname:=MainForm").SwfTable("swfname:=" &strObjectName)
objSub.SetCellData MyTest(1),"Select","True"

End Function
‘****************************************************************************************

Here is my attempt at the grid with two checkboxes per row. I have code not shown that get me to the correct window. But once on the window nothing happens and QTP times out and ends.

‘****************************************************************************************

Function TableQualifyingCheckBoxSelect(strInputValue, strObjectName)
Dim MyTest
MyTest = split (strInputValue,":")
Set objSub = SwfWindow("swfname:=Select Qualifying/Disqualifyin").SwfTable("swfname:=" &strObjectName)
objSub.SetCellData MyTest(1),"Qualifying","True"

End Function
‘****************************************************************************************

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on April 9, 2013 1:20 pm
223 views
Answers (2)
0
Private answer

Sorry I am not familar with entering things into this web site. I would be glad to format my code, but I can not figure out how to do it. The error I get is the following:

Object Name Inut Value Failed Action
savingsCheckingQualifyingUltraGrid Row:1 TableQualifyingCheckBoxSelect

Error Description
Object doesn't support this action

Marked as spam
Posted by (Questions: 2, Answers: 1)
Answered on April 9, 2013 5:53 pm
0
Private answer

![alt text][1]

[1]: /storage/temp/82-insertingcode.jpg

Above is a screenshot of how to format code.

Can you please give the exact line that QTP is failing on? From what you provided it looks like your object is not getting set correctly. At first I would get rid of the parameters while you are trying to fix your functions (get rid of &strObjectName, MyTest(1), substitute them with hardcoded values until you get it to work for those values.)

Marked as spam
Posted by (Questions: 3, Answers: 12)
Answered on April 9, 2013 7:55 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top