Forum Discussion

mikakoistinen's avatar
mikakoistinen
Contributor
7 years ago

Records or other structures in delphi scripts

Hi,

My colleague asked a tricky question. How to internally store/pass record like structures between delphi script routines.

Records are not supported. So is there any way to use json objects in delphi scripts?

Or any other trick?

 

  • How about using Dictionary objects? A dictionary contains key=value pairs, which is similar to an object with named properties.

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    How about using Dictionary objects? A dictionary contains key=value pairs, which is similar to an object with named properties.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    That's a GOOD question.

    I would have suggested that you use the ODT object structures available in TestComplete to create custom classes and objects.  That is what I've done in the past with good success.  They are deprecating that feature some day (but not yet since there are a lot of people still using it) so I wouldn't recommend going that way.

     

    An alternative (and this is just a mental thought) is to create some sort of generic code in a JScript script extension where you can create an object and add properties to it.  That MIGHT work... I've played around with the idea to some success.  That way you would call some routine from the extension to create an object with a set of properties (say, pass in an array) and the extension code would return an instance of that object for you to use.