pmahesha
13 years agoOccasional Contributor
Reading table values and comparing
I have an issue with comparing the values from a table (Reading one value at a time from table Dynamically). I use Java script.
Here is the Code for reading one value from second column in a table:
function test10()
{
var tableIndex=59;
HeaderTableAddress=Aliases.MainProcess.SwingObject("ea", "Dicom Tag Information", -1, 1).SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("JPanel", "", 0).SwingObject("JScrollPane", "", 0).SwingObject("JViewport", "", 0).SwingObject("JTable", "", 0);
var value=HeaderTableAddress.wValue(tableIndex,2);
if(value!=HeaderTableAddress.wValue(tableIndex,2))
{
Log.Error("Failed Expected Value = "+value+" Actual = "+HeaderTableAddress.wValue(tableIndex,2));
}
}
When I run this code, I get the failure. But values are correct as displayed below:
Failed Expected Value = 20091220 Actual = 20091220
So I used Trim.
var value=Trim(HeaderTableAddress.wValue(tableIndex,2));
It works fine as long as there is no Null characters in the table. When null character is encountered, I get error message:
Trim. Could Not convert variant of type (Dispatch) into type (String)
So what is the solution?
Q1. How to read and compare table values without using Trim (Note that table contains strings as well as numbers)
Q2. How to use Trim when there is a null?
Here is the Code for reading one value from second column in a table:
function test10()
{
var tableIndex=59;
HeaderTableAddress=Aliases.MainProcess.SwingObject("ea", "Dicom Tag Information", -1, 1).SwingObject("JRootPane", "", 0).SwingObject("null.layeredPane").SwingObject("null.contentPane").SwingObject("JPanel", "", 0).SwingObject("JScrollPane", "", 0).SwingObject("JViewport", "", 0).SwingObject("JTable", "", 0);
var value=HeaderTableAddress.wValue(tableIndex,2);
if(value!=HeaderTableAddress.wValue(tableIndex,2))
{
Log.Error("Failed Expected Value = "+value+" Actual = "+HeaderTableAddress.wValue(tableIndex,2));
}
}
When I run this code, I get the failure. But values are correct as displayed below:
Failed Expected Value = 20091220 Actual = 20091220
So I used Trim.
var value=Trim(HeaderTableAddress.wValue(tableIndex,2));
It works fine as long as there is no Null characters in the table. When null character is encountered, I get error message:
Trim. Could Not convert variant of type (Dispatch) into type (String)
So what is the solution?
Q1. How to read and compare table values without using Trim (Note that table contains strings as well as numbers)
Q2. How to use Trim when there is a null?