# 複数の関連レコードのデータをCSV出力したい

**URL:** <https://community.cybozu.dev/t/topic/6744>\
**Category:** kintone 開発相談\
**Created:** [October 6, 2020, 2:14am UTC](https://community.cybozu.dev/t/topic/6744 "2020-10-06T02:14:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account1339](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Legacy\_Account1339](https://community.cybozu.dev/u/Legacy_Account1339)\
**Post date:** [October 6, 2020, 2:14am UTC](https://community.cybozu.dev/t/topic/6744/1 "2020-10-06T02:14:12Z")

</div>

やりたいこと：js初心者です。

アプリAでは、アプリBとアプリCからの2つの関連レコードを表示させています。

アプリAの関連レコードとして、アプリBとアプリCの内容をCSV出力したいと考えています。

問題：下記を参考に、１つの関連レコードはCSV出力できたのですが、

[https://developer.cybozu.io/hc/ja/articles/203605844](https://community.cybozu.dev/hc/ja/articles/203605844)

複数アプリからの複数関連レコードをCSV出力するにはどのようにすれば良いのでしょうか。

この方法では実現できないのでしょうか？

---

<div class="post-metadata">

**Author:** ![Legacy\_Account1384](https://avatars.discourse-cdn.com/v4/letter/l/97f17d/32.png) [@Legacy\_Account1384](https://community.cybozu.dev/u/Legacy_Account1384)\
**Post date:** [October 21, 2020, 3:05am UTC](https://community.cybozu.dev/t/topic/6744/2 "2020-10-21T03:05:39Z")

</div>

mk 様

こんにちは。記載して頂いた記事の方法を元に、  
fetchRelatedRecords ()で複数の関連レコードを取得するように記述を追加することで、  
複数の関連データの出力は可能かと思います。

複数の関連レコードを取得するには、  
こちらのようにPromise.allを使うと良いかもしれません。ご参考になれば幸いです。  
[https://developer.cybozu.io/hc/ja/community/posts/360055820272/comments/360008742712](https://developer.cybozu.io/hc/ja/community/posts/360055820272/comments/360008742712)

---

<div class="post-metadata">

**Author:** ![Legacy\_Account1339](https://avatars.discourse-cdn.com/v4/letter/l/a5b964/32.png) [@Legacy\_Account1339](https://community.cybozu.dev/u/Legacy_Account1339)\
**Post date:** [December 16, 2020, 1:46am UTC](https://community.cybozu.dev/t/topic/6744/3 "2020-12-16T01:46:53Z")

</div>

ご返信が遅くなり申し訳ございません。ご教授ありがとうございます。試してみます。
