# Assign value from conditions based on a table

**URL:** <https://community.easymorph.com/t/assign-value-from-conditions-based-on-a-table/2292>\
**Category:** General Q&A\
**Created:** [December 2, 2020, 3:27pm UTC](https://community.easymorph.com/t/assign-value-from-conditions-based-on-a-table/2292 "2020-12-02T15:27:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreaM](https://community.easymorph.com/user_avatar/community.easymorph.com/andream/32/771_2.png) [@AndreaM](https://community.easymorph.com/u/AndreaM)\
**Post date:** [December 2, 2020, 3:27pm UTC](https://community.easymorph.com/t/assign-value-from-conditions-based-on-a-table/2292/1 "2020-12-02T15:27:16Z")

</div>

Hello everyone,

I've to set a value on a table using conditions based on a table. I try to better explain, this is the rule-table:

| CustomerCode | From | To | Value |
| --- | --- | --- | --- |
| 3828 | 08/01/2020 | 15/01/2020 | CA |
| 905413 | 09/01/2020 | 16/01/2020 | CA |
| 12751 | 20/02/2020 | 02/03/2020 | CB |
| 3828 | 20/02/2020 | 02/03/2020 | CB |

In another table I've to verify the customer code and if the order date is between From--To, if the record satisfy every condition I've to set the field to CA/CB.

usually I'll go with a function with nested if (if customer=3828 -- if orderdate beetween a and b then CA), but I've got 50+ rules so I'm asking if is there another way to achieve this.

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [December 2, 2020, 8:27pm UTC](https://community.easymorph.com/t/assign-value-from-conditions-based-on-a-table/2292/2 "2020-12-02T20:27:23Z")

</div>

The "Interval Merge" action should do it. See the attached example:

[interval-match.morph](https://community.easymorph.com/uploads/short-url/hsFachkdfbcKFoA2ZK8WcmOUfA9.morph) (4.3 KB)

 ![image](https://community.easymorph.com/uploads/default/original/2X/a/a0a7cf9757dea63501ad67e3b07ca45e269ee1b1.png)

See also: [Rules on 2 or more tables](https://community.easymorph.com/t/rules-on-2-or-more-tables/952)

---

<div class="post-metadata">

**Author:** ![AndreaM](https://community.easymorph.com/user_avatar/community.easymorph.com/andream/32/771_2.png) [@AndreaM](https://community.easymorph.com/u/AndreaM)\
**Post date:** [December 3, 2020, 3:43pm UTC](https://community.easymorph.com/t/assign-value-from-conditions-based-on-a-table/2292/3 "2020-12-03T15:43:43Z")

</div>

This software is awesome. Really: one of the best UX, alot of actions, and very intuitive: compliments!

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [December 3, 2020, 4:00pm UTC](https://community.easymorph.com/t/assign-value-from-conditions-based-on-a-table/2292/4 "2020-12-03T16:00:11Z")

</div>

Thank you 🙂
