This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

phplee
phplee

I have a registration list which I'm exporting. Im using a repeater to allow group booking so the user can simply just add more registrants to their booking. However when i export the list i want to export each repeater as a row in the cvs file.

Can this be done and if so can anyone please give me a idea on how i can achieve this.

thanks

slowpokefarm
slowpokefarm

This is done in your Export model in exportData method. Try to iterate through your model property which contains registrants and save them as new indexes in exported array.

public function exportData($columns, $sessionKey = null)
{
    $export = [];
    $booking = $this->booking;
    $export[] = [
        'some_booking_data' => $booking->data,
    ];

    foreach ($booking->registrants as $registrant)
    {
        $export[] = [
            'some_booking_data' => $registrant->data,
        ];
    };

    return $export;
}

Something like this.

phplee
phplee

thanks will give it a go

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.