I am trying to write a test to validate if specific column names (headers) exist or not. I was hoping I could get the object.ColumnCount (which works) then iterate through each column index grabbing the Key property, something like the following:
oObject.GetNAProperty("DisplayLayout.Bands[0].Columns[1].Key")
I cannot get this line to work properly, it is failing, maybe it doesn't like my syntax. I know the Bands is correct because I can pull property values that are a direct child of Bands[0], I just can't seem to get inside the Columns collection.
Thanks
Hello,
Thank you for contacting Infragistics.
In giving you the answer below, I'm assuming you did not make any typing mistakes when creating your post.
The code you passed into the GetNAProperty() method refers to the Band collection when it should be plural: "DisplayLayout.Bands(0).Columns(2).Key".
Please let me know if you have any other questions about this.
Hi,
I am able to find out Key for a column using .Net spy tool. I found the key on below path :- DisplayLayout.Band[0].Column[2].Key.
But when I am trying to run the below code :- SwfWindow("FIDPG CreditOne - New").SwfWindow("Quote Sheet").SwfTable("UltraGrid").GetNAProperty("DisplayLayout.Band(0).Columns(2).Key") I am getting following error :- DisplayLayout.Band(0).Columns(2).Key is malformed.
Please suggest me solution.
But when I am trying to run the below code :- SwfWindow("FIDPG CreditOne - New").SwfWindow("Quote Sheet").SwfTable("UltraGrid").GetNAProperty("DisplayLayout.Band(0).Columns(2).Key") I am getting following error :- DisplayLayout.Band(0).Columns(2).Key is overhalmed.
QTP seems to get confused or hung up at times, so I'm glad to hear that you got it to work.
Also, thank you for sharing your code as it's always interesting to see how others do things!
Here's the code in case you were curious, thanks for your help.
Set oParent = SwfWindow("C1Home")Set oObject = oParent.SwfTable("GridDataTable")oObject.WaitToExist 10, TRUE
iColumns = oObject.ColumnCountmsgbox "Total Columns = " & iColumnsFor i = 0 to (iColumns - 1) Reporter.ReportEvent micDone, oObject.GetNAProperty("DisplayLayout.Bands[0].Columns[" & i & "].Key"), "..."Next