Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to download sub_document in xlsx format #826

Closed
gomathi04 opened this issue Feb 15, 2017 · 4 comments
Closed

Not able to download sub_document in xlsx format #826

gomathi04 opened this issue Feb 15, 2017 · 4 comments

Comments

@gomathi04
Copy link

Hi,

I have a list of user details in that each user object have list of family members , I want to download user details along with family member details , but in excel I am getting family member details as [object] [object][object] I tried MATRIX but am getting same result ,Is there any possibilities to format like below

.username1, mobile , mail , address,age,gender, number of family members
member1_name , member1_age,member1_gender
member2_name.member2_age,member2_gender_
.username2, mobile , mail , address,age,gender, number of family members
member1_name , member1_age,member1_gender
.xlsx or any other report format is fine..

here is my jsfiddle link https://jsfiddle.net/x0foycyq/

Please suggest.

@agershun
Copy link
Member

To extract data from nested objects you need to use SEARCH statement. In your case it shoul be something like:

var res =   alasql("SEARCH / AS @user Members / AS @member \
	RETURN(@user->Id AS UserId, @user->Name AS UserName, \
       @member->Name AS MemberName, @member->Age AS MemberAge) \
	INTO XLSX('member_Track.xlsx',{headers:true,sheetid:'member_Track'}) \
	FROM $0 ",[users]);

You need to modify RETURN(...) clause to include all fields you need.

@gomathi04
Copy link
Author

Thank you so much .... you really saved my day ....

@mathiasrw
Copy link
Member

I updated the documentation of RETURN in the wiki: https://github.com/agershun/alasql/wiki/RETURN

@gomathi04
Copy link
Author

Thank you ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants