mel47 Posted January 30, 2018 Share Posted January 30, 2018 Hi, I request an advice from experimented users! It's my first time for developing for someone else, so I have to take in account her needs and capabilities. She used to work with a CSV file to sort/copy data mainly because the old website was strangely constructed, with only one table in database and I suppose it was easy to create a CSV file. But now, with the new PW site, I used many templates with many repeaters etc and I don't know how to export all these data in CSV file. Using existing modules for export CSV don't work, since I have to append different pages together. How you manage to export data? She needs things like export all emails or phone number to her documents, she also sorted and others basic queries like this etc... Do you use exclusively admin interface to display data to user? But how export? Which format else than CSV could be more convenient for end-user in a "normal" desktop (good chance to be Office suite)? Looking forward for ideas! ;-) Thanks Melanie Link to comment Share on other sites More sharing options...
adrian Posted January 30, 2018 Share Posted January 30, 2018 You can manually build the export however she needs. I would recommend https://github.com/PHPOffice/PhpSpreadsheet so you can write directly to Excel format. I would write an AdminActions action so you can give her a form to choose what she wants exported. 3 Link to comment Share on other sites More sharing options...
FrancisChung Posted January 30, 2018 Share Posted January 30, 2018 An alternative could be to export to an XML format for Excel. But without knowing your exact requirements, it's hard to tell if it solves your problem. There's a detailed discussion here with sample code. Link to comment Share on other sites More sharing options...
mel47 Posted January 31, 2018 Author Share Posted January 31, 2018 Thanks. To be honest, I was completely exhausted to have fighted all weekend with custom CSV export, due to repeaters. This is why I was looking for something else. I will check this. But having the possibility to choose fields to export via a form in admin would be the Graal... ;-) Melanie Link to comment Share on other sites More sharing options...
adrian Posted January 31, 2018 Share Posted January 31, 2018 Remember I started to implement CSV export for repeater fields in the Batch Child Editor module. You mentioned it didn't work for you (https://processwire.com/talk/topic/6102-batch-child-editor/?do=findComment&comment=155702) but we could probably try to figure out why it didn't work at your end. 1 Link to comment Share on other sites More sharing options...
mel47 Posted February 1, 2018 Author Share Posted February 1, 2018 @adrian It's not that it didn't work, in fact we use it temporarily until I find a more complete solution. The problem is the shifting cells because, I guess, it didn't calculate how many repeaters have to be inserted as rows. I found this, but I suppose it's too old because it didn't do anything (or I didn't understand what it was supposed to do). I try to do it on my custom export, but I'm really bad with arrays and loops... Link to comment Share on other sites More sharing options...
FrancisChung Posted February 4, 2018 Share Posted February 4, 2018 On 2/1/2018 at 1:45 PM, mel47 said: but I'm really bad with arrays and loops... Try using a foreach loop if you're bad with arrays and loops. It will iterate through each member of a collection (or arrays) and you don't have to worry about setting it up initially or its exit conditions. The article I posted previously has an example of it. For further reading :http://php.net/manual/en/control-structures.foreach.php Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now