DHB
14 years agoOccasional Contributor
ODT Classes: Switching references
Hello,
I am working with ODT classes and my problem is the following limitation: "We would like to note that the objects you create via the ODT project item can
be referred to only by one property, array item or data-group variable at a
time. That is, an object cannot be referred to by several properties, array
items or variables in data groups. For instance, if you need to exchange values
of two properties, you will have to assign an empty value to one of these
properties." (taken from TC help, Working With Custom Objects in Scripts).
To bypass this I wrote the following routine:
procedure toogle_reference(
var a_ref_source : OleVariant,
var a_ref_destination : OleVariant);
var
h_temp : OleVariant;
begin
h_temp := a_ref_source;
a_ref_source := NIL;
a_ref_destination := h_temp;
h_temp := NIL;
end;
Usage in my case:
toggle_reference(Self.Testenvironment, Self.Testcases[h_i].Testenvironment);
But this is not working, because "Self" is not a known variable.
I want to use a routine, because I do not want to do unnecessary code copy and write this code (with comment) every time I need to switch references.
(TC Enterprise 7.52.678.7)
Thanks,
Dirk
I am working with ODT classes and my problem is the following limitation: "We would like to note that the objects you create via the ODT project item can
be referred to only by one property, array item or data-group variable at a
time. That is, an object cannot be referred to by several properties, array
items or variables in data groups. For instance, if you need to exchange values
of two properties, you will have to assign an empty value to one of these
properties." (taken from TC help, Working With Custom Objects in Scripts).
To bypass this I wrote the following routine:
procedure toogle_reference(
var a_ref_source : OleVariant,
var a_ref_destination : OleVariant);
var
h_temp : OleVariant;
begin
h_temp := a_ref_source;
a_ref_source := NIL;
a_ref_destination := h_temp;
h_temp := NIL;
end;
Usage in my case:
toggle_reference(Self.Testenvironment, Self.Testcases[h_i].Testenvironment);
But this is not working, because "Self" is not a known variable.
I want to use a routine, because I do not want to do unnecessary code copy and write this code (with comment) every time I need to switch references.
- Any suggestions how to bypass this situation?
- Is there an integrated way to clone objects? (because I do not change the object properties, I only read their values)
(TC Enterprise 7.52.678.7)
Thanks,
Dirk