Accessing Members of a Tuple

I understand how to define a tuple, and how to load data into a tuple. However, I am writing a query in which I wish to output in CSV format, and I need to access the members of that tuple. How do you do that? I can’t find out how to do that from the language reference.

Thanks!

Hi achbach,

You can access members of the tuple by a . and then the name that is assigned to them at creation.

If a vertex has a Tuple:

TYPEDEF TUPLE <STRING ticker, FLOAT price, DATETIME orderTime> ORDER_RECORD;

Then you could reference the price of that ORDER_RECORD tuple with ORDER_RECORD.price

In the below example, assume that our Order vertex has an attribute record which is a tuple of type ORDER_RECORD

res = SELECT o FROM Order:o
    ACCUM
        @@price_accumulator += o.record.price;

Hope this is helpful
-Dan

1 Like

Dan,

Great, thanks! I’ll give that a try.