# Replace cardinality-many attribute

**URL:** <https://forum.datomic.com/t/replace-cardinality-many-attribute/759>\
**Category:** General\
**Created:** [December 23, 2018, 8:45am UTC](https://forum.datomic.com/t/replace-cardinality-many-attribute/759 "2018-12-23T08:45:23Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![marshall](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.datomic.com/marshall/32/48_2.png) [@marshall](https://forum.datomic.com/u/marshall)\
**Post date:** [December 26, 2018, 7:03pm UTC](https://forum.datomic.com/t/replace-cardinality-many-attribute/759/2 "2018-12-26T19:03:26Z")

</div>

As you’ve surmised, there is not a built-in function for “replace all targets” of a given many-cardinality attribute.

The general approach to solving this problem is to use a transaction function (or a tx-fn Ion if you’re using Cloud).

A related post (also on SO) presents an additional description and approach: [https://stackoverflow.com/questions/42112557/datomic-schema-for-a-to-many-relationship-with-a-reset-operation](https://stackoverflow.com/questions/42112557/datomic-schema-for-a-to-many-relationship-with-a-reset-operation)

---

_[View the full topic](https://forum.datomic.com/t/replace-cardinality-many-attribute/759)._
