In reply to Muthuvenkatesh:
This is invalid. “if(tr[1].exists())” you are calling the method which is not existed in transaction class. Several things that you need to do:
- transaction tr: This is dynamic array, you need create this array with specified number of elements.
For example:
tr = new[10]; // 10 elements are created
- To check element is created or not, you can compare with null.
if(tr[1] != null)
$display("class is available");
else
$display("class is not available");
Note: If you use associated array, it provides you a method “exists” to check that current element is existed in array or not.