Jump to content
Sign in to follow this  
BennieC

Converting tuples into Delphi objects

Recommended Posts

I am struggling with getting my results into Delphi.  I have used direct access to the Python function as shown in the screencopy and in fact receive the correct results in Delphi using Code insight as shown.  But I have no success in actually accessing this tuple from Delphi

image.thumb.png.d17ceb8c99d1f4d7aaafe4b01789a76d.png

There are three items in the tuple (which is declared as a variant), the first containing a list of arrays, the second an array and the third a list of values.

How do I individually access these values in Delphi - some sample code will help as I can't find anything in the demos and my knowledge of variants is quite inadequate.

Kind regards

Share this post


Link to post

Try something like that 

    for I := 0 to  myPlateTuple.Length - 1 do
    begin
        var Sub := myPlateTuple.GetItem(I);
    end;

see: 

 

Share this post


Link to post

Thank you very much.  The problem is that there are different arrays in the tuple and unless I can separate them I don't know how to convert the variants into Delphi variables.  The lengths are not always as short as the sample and can indeed be very long.

I was hoping to use something like

aTmpvariant1 := myPlatTuple[0]

aTmpvariant2 := myPlatTuple[1]

etc, and then be able to individually decode these like

aDelphiVal1 := aTmpvariant1[0], etc.

but that does not work.

Share this post


Link to post

Apologies

I solved the problem - just me being stupid.  I misunderstood the GetItem method.  All seems to be working now.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×