I am trying to set the value of a cell in a table to Maximum. The code is:
SwfWindow("Mom").SwfWindow("ProposedOrders 1").SwfWindow("Allocations Grid Column").SwfTable("summaryChooserGrid").SetCellData "4","Summary","Maximum"
This changes the value in the Summary Column to "Max"
Following this, QTP throws the error referenced in the Subject line of this post. Any help would be greatly appreciated.
There are two ways to set the value of an UltraGridCell using TestAdvantage and QuickTest Professional.
The first being SetCellData, what this does is programmatically set the value directly on the cell. This works in most scenarios, the limitation being the value that you are setting must be valid for the cell. If you are using some form of masking on the editor, or trying to set a numeric editor with a alphanumeric value that is invalid, that's where you will likely hit problems. Another would be, if the developer put a form of data filter on the cell that translates the value to something different then what is displayed.
The other method is SetInvalidDataCell, this is used for cells that have some form of text editor as their editor. How it is executed is giving the cell focus, then sending a string of keys equal to the value that you want set, then exiting the cell. This is usually ideal, and how the method got its name, is for setting values that are not valid. Such as a scenario like typing "ABC" into an editor that is expecting a dollar value.
I believe that in your scenario that SetCellData may be bypassing some DataFilter or other code that would normally be hit by manually entering the data, I would suggest trying SetInvalidDataCell.
Let me know if this works for you.