# Or statement with slot\_was\_set

**URL:** <https://forum.rasa.com/t/or-statement-with-slot-was-set/51244>\
**Category:** Rasa Open Source\
**Created:** [February 9, 2022, 5:54pm UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244 "2022-02-09T17:54:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amiratqa](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amiratqa](https://forum.rasa.com/u/amiratqa)\
**Post date:** [February 9, 2022, 5:54pm UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/1 "2022-02-09T17:54:39Z")

</div>

I am using RulePolicy and MemoizationPolicy.

I have two slots ‘country’ and ‘city’ with influence\_conversation: true

I am updating their values in a custom-action ‘action\_change\_address’

The story goes like this:

- story: main steps:
  - intent: greet
  - action: utter\_greet
  - action: action\_change\_address
  - or:
    - slot\_was\_set:
      - country: germany
      - city: berlin

    - slot\_was\_set:
      - country: UK
      - city: london

  - action: utter\_about

I want the bot to utter ‘about’ if the custom action sets country and city slots to either UK, london or germany,berlin. Therefore I am using ‘OR’ statement.

However the bot runs ‘action\_default\_fallback’. Can anyone guide me? It says there is no memorized next action and no applicable rule.

Custom action:

```auto
class ActionChangeAddress(Action):

    def name(self) -> Text:

        return "action_change_address"

    def run(self, dispatcher: CollectingDispatcher,

            tracker: Tracker,

            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        dispatcher.utter_message(text="Hello World!")

        return [SlotSet(key = 'country',value = 'UK' ), SlotSet(key = 'city',value = 'london' )]

```

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [February 9, 2022, 6:02pm UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/2 "2022-02-09T18:02:43Z")

</div>

I suggest building this story using Interactive Learning on Rasa X 🙂

---

<div class="post-metadata">

**Author:** ![amiratqa](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amiratqa](https://forum.rasa.com/u/amiratqa)\
**Post date:** [February 9, 2022, 6:31pm UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/3 "2022-02-09T18:31:50Z")

</div>

> I want the bot to utter ‘about’ if the custom action sets country and city slots to either UK, london or germany,berlin. Therefore I am using ‘OR’ statement.

Do not know how to do this in Interactive Learning on Rasa X

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [February 9, 2022, 9:11pm UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/4 "2022-02-09T21:11:00Z")

</div>

Please learn about interactive learning in [Rasa Shell](https://rasa.com/docs/rasa/writing-stories/#using-interactive-learning) and [Rasa X](https://rasa.com/docs/rasa-x/user-guide/share-assistant/#talk-to-your-bot). It really helps a lot.

---

<div class="post-metadata">

**Author:** ![amiratqa](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amiratqa](https://forum.rasa.com/u/amiratqa)\
**Post date:** [February 10, 2022, 12:19am UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/5 "2022-02-10T00:19:47Z")

</div>

How to use interactive learning on custom action? I can’t change the slot values being set and I need a way to create stories for both {UK,London} and {Germany, Berlin}

There isn’t much in the documentation about it. I know how to run the shell and interact with the bot but not for this particular usecase.

I know the custom action implemented right now is static but what if it was dynamic and the values could change?

Just want to know how to use OR statement with multiple slots? It works fine with a single slot! And the documentation also only states an example which uses one slot updating in a custom\_action.

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [February 10, 2022, 7:41am UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/6 "2022-02-10T07:41:47Z")

</div>

> [@amiratqa](#):
>
> How to use interactive learning on custom action? I can’t change the slot values being set and I need a way to create stories for both {UK,London} and {Germany, Berlin}

You can’t change the custom action.

But as I understand, your story is fine until `utter_about`, so use interactive learning, and when `action_change_address` gets executed, you tell it to execute `utter_about` next.

> [@amiratqa](#):
>
> I know the custom action implemented right now is static but what if it was dynamic and the values could change?
> 
> Just want to know how to use OR statement with multiple slots? It works fine with a single slot! And the documentation also only states an example which uses one slot updating in a custom\_action.

It is not recommended to use many OR statements. There surely is a better way of doing this.

Why not use the [`FollowupAction()` event](https://rasa.com/docs/action-server/sdk-events/#followupaction) inside the action?

---

<div class="post-metadata">

**Author:** ![amiratqa](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amiratqa](https://forum.rasa.com/u/amiratqa)\
**Post date:** [February 10, 2022, 7:59am UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/7 "2022-02-10T07:59:44Z")

</div>

How exactly will that help? I don’t think it’ll solve my problem. Can you recommend something else?

I just have to join multiple stories into one after a custom\_action that is setting more than one slot value

---

<div class="post-metadata">

**Author:** ![amiratqa](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@amiratqa](https://forum.rasa.com/u/amiratqa)\
**Post date:** [February 10, 2022, 8:05am UTC](https://forum.rasa.com/t/or-statement-with-slot-was-set/51244/8 "2022-02-10T08:05:38Z")

</div>

My task is to basically set multiple slot values in a custom\_action.

But the documentation says if any custom\_action is setting a slot, I should add the slot event in the story right after custom\_action call using slot\_was\_set. The example available explains how to do this using only one slot.

> **[Stories](https://rasa.com/docs/rasa/stories/#slot-events)**
>
> Stories are used to teach Rasa real conversation designs to learn from providing the basis for a scalable machine learning dialogue management.

Slot\_was\_set:

- slot:value

My problem is that the custom\_action will fill the slot in runtime so I do not know the ‘value’ to put under slot\_was\_set while writing the story. This is the reason I was trying to use OR statement. So that I can put all possible values of ‘value’ under the custom\_action call in the story.
