# repeating group内の小計を要素の外で合計したい

**URL:** <https://www.nocode-faq.com/t/topic/4157>\
**Category:** bubble\
**Tags:** フロントエンド\
**Created:** [2024 年 2 月 29 日午前 11:11 UTC](https://www.nocode-faq.com/t/topic/4157 "2024-02-29T11:11:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![john03tgck01a](https://sea2.discourse-cdn.com/flex020/user_avatar/www.nocode-faq.com/john03tgck01a/32/4558_2.png) [@john03tgck01a](https://www.nocode-faq.com/u/john03tgck01a)\
**Post date:** [2024 年 2 月 29 日午後 1:47 UTC](https://www.nocode-faq.com/t/topic/4157/2 "2024-02-29T13:47:51Z")

</div>

Javascriptのdocument.querySelectorを使うことで、Repeating Group内の値を個別に指定して取得することができます。

> **[Gyazo Screen Video](https://gyazo.com/b6306f8b4e2e8d1bf9fff3d4681d5972)**
>
> Gyazo is the easiest way to record screenshots & videos you can share instantly. Save time with async visual communication that's effortless and engaging.

エラーハンドリングしていませんが、以下のコードを使用しています。

```auto
let result = []

for(i=1;i<=<Repeating Group List Count>;i++){
let x = parseFloat(document.querySelector(`#price_${i}`).value);
let y = parseFloat(document.querySelector(`#item_${i}`).value);
result[i] = x * y
}

bubble_fn_total(result)

```

Repeating group内のリストカウント分の掛け算を繰り返し処理(for文）を使って実装しています。  
document.querySelectorを使う場合、input formsにidを付与する必要があるので、current cell’s indexを使って、他と被らないidを付与してあげてください。

 ![スクリーンショット 2024-02-29 15.44.41](https://us1.discourse-cdn.com/flex020/uploads/ncc_forum/original/2X/2/25ec24e74a3a2597ca7d943e1e9e4f2548bf1fb4.png)

BubbleでJSを使う方法については、こちらの動画で解説しています。

> **[【Bubble構築＆質問会】Javascriptの使い方解説](https://www.youtube.com/live/xMFnciMy4hM?si=gmkqDxdGkKqlqE3V&t=2329)**
>
> ノーコードツールBubbleの開発を共有しながら、質問募集をしていきます。自社開発中のアプリやちょっとしたTipsなどを画面共有しながら解説していますが、Bubbleの質問であればなんでもOKです。お気軽に参加ください。・配信者じょん - KoronCoron CEOBubble受託開発2年目 / エストニアに起...

---

_[View the full topic](https://www.nocode-faq.com/t/topic/4157)._
