# Synchronized input with linked datasets

**URL:** <https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939>\
**Category:** Help\
**Created:** [May 16, 2023, 8:42pm UTC](https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939 "2023-05-16T20:42:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mferro64](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mferro64/32/6421_2.png) [@mferro64](https://talk.observablehq.com/u/mferro64)\
**Post date:** [May 16, 2023, 8:42pm UTC](https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939/1 "2023-05-16T20:42:53Z")

</div>

I am working on a couple map examples. I was using this notebook as a starting point - [Keeping inputs and views synchronized / Brianna Wilson | Observable](https://observablehq.com/d/eae532ac2c462fcd). I am trying to link the state inputs to the bills dataset - so if multiple states are selected the horizontal bar will add the names in the y channel.

I am using the following to link the 2 datasets:

```auto
filter_vote = bills.filter(d => d.name === selectedStates[0].properties.name)

```

My example notebook is here - [grid\_map / mferro64 | Observable](https://observablehq.com/d/250f726ff5331f89#cell-449)

Thanks for any help,

Mike

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [May 17, 2023, 6:45am UTC](https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939/2 "2023-05-17T06:45:03Z")

</div>

Can you add a static example of what you expect the result to look like?

---

<div class="post-metadata">

**Author:** ![mferro64](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mferro64/32/6421_2.png) [@mferro64](https://talk.observablehq.com/u/mferro64)\
**Post date:** [May 17, 2023, 5:37pm UTC](https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939/3 "2023-05-17T17:37:23Z")

</div>

I created an example using checkbox input - ideally I want to use the map as the input for multiple selections

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/observablehq/original/2X/1/1e25efeb11f6e7c3e5457672b29b5be55d065ac9.png)

---

<div class="post-metadata">

**Author:** ![mootari](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mootari/32/581_2.png) [@mootari](https://talk.observablehq.com/u/mootari)\
**Post date:** [May 17, 2023, 6:26pm UTC](https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939/4 "2023-05-17T18:26:37Z")

</div>

Is this what you’re looking for?

```auto
filter_vote = {
  const names = new Set(selectedStates.map(d => d.properties.name));
  return bills.filter(d => names.has(d.name));
}

```

By the way, I would try to choose a different wording than “synchronized”. In the context of Observable and inputs, “synchronized” is commonly understood as two-way binding between inputs, while your use case appears to “just” involve the downstream dataflow. 🙂

---

<div class="post-metadata">

**Author:** ![mferro64](https://yyz2.discourse-cdn.com/flex030/user_avatar/talk.observablehq.com/mferro64/32/6421_2.png) [@mferro64](https://talk.observablehq.com/u/mferro64)\
**Post date:** [May 17, 2023, 7:44pm UTC](https://talk.observablehq.com/t/synchronized-input-with-linked-datasets/7939/5 "2023-05-17T19:44:40Z")

</div>

> [@mootari](#):
>
> ```auto
> filter_vote = {
> const names = new Set(selectedStates.map(d => d.properties.name));
> return bills.filter(d => names.has(d.name));
> }
> 
> ```

Thanks for the help! - that worked and I will take that into account when I write a title for the post
