Exporting excel/csv doc

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Exporting excel/csv doc

Post by idpSteve »

Hi All.

I need to allow some of my users to export data from my app. The data they need to get out must include related objects. This would be OK if I didn't have multiple allowed objects that I need to export, but one of the related objects is a many to many relationship. I'd want to see something similar to the following:

Parent.Name, Parent.Surname, Parent.Child.Name, Parent.Child.Surname, Parent.Child.Name, Parent.Child.Surname, ...

When importing from a csv there is the option to map to a path. This doesn't exist for exporting.

Is my best option going to be making the csv string for each record manually and export only the attribute with the string in it? Would that even work? :|

Something like:

PROC1

Parent.csvString=Parent.Name+', '+Parent.Surname
FIND Child WHERE (Child IN Parent.Children)
PROC2

PROC2
Parent.csvString=Parent.csvString+', '+Child.Name+', '+Child.Surname

Really not ideal.. Any better solutions would be great.
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Exporting excel/csv doc

Post by customaware »

Steve,

If you are ok concatenating X number of Children to the String then I would recommend using the LIST_LINE function which works perfectly for building this kind of string.

I am down in the Gobi Desert at the moment but have a crack at it and if you get stuck I will do a demo up for you once I get home later in the week.
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
idpSteve
Posts: 201
Joined: Thu Jul 27, 2017 6:13 am
Location: Johannesburg, South Africa
Contact:

Re: Exporting excel/csv doc

Post by idpSteve »

Thanks, Mark.

I had forgotten about LIST_LINE. I was using LIST_TABLE in my excel template which works well if there aren't related fields.

I'll give it a go and see how I can use it, although I think I'll end up in the same place. LIST_LINE might be able to do something I don't know of.

I'll post here later today or tomorrow.

Thanks again!
Post Reply