# 로직 만들기

로직이란, "어떤 값이 입력되면 어떤 행동을 한다." 와 같이 인과관계가 있는 일련의 과정이에요.

로직을 만들 수 있으면 원하는 기능을 직접 구현할 수 있어요.&#x20;

오마이앱에서 로직을 만드는 방법은, 원하는 기능을 "\_하면 \_에서\_한다." 의 형식에 맞추어 작성하면 돼요.

* **If When** : 데이터가 처리되는 유형
* **Where** : 데이터가 처리되는 곳
* **Then** : 데이터가 처리된 후 진행될 활동<br>
* [**로직 설정**](/main/guide/dictionary/logic.md)

관리자 웹 ➡︎ 로직 설정 ➡︎ '+' 버튼 클릭 ➡︎ 각 빈칸을 채워 주세요.&#x20;

ex)  "내가 작성한 글에 다른 유저가 좋아요를 누르면, 나에게 푸시 알림을 발송한다."

1. 좋아요를 누르면 하나의 데이터가 저장/등록 돼요. » 유형 : Data is created(등록)
2. 좋아요는 하나의 데이터예요. » 데이터가 처리되는 곳 : 데이터 로그\*
3. 좋아요를 눌러 하나의 데이터가 등록되면 푸시를 발송해요. » 처리 후 진행 : Send Push Notifications (푸시 알림 발송)

<div align="left"><figure><img src="/files/0KNw15gyA9awpUe6L5pr" alt="" width="318"><figcaption></figcaption></figure></div>

\*데이터 로그 : 발생하는 모든 상황의 데이터가 기록되는 곳이에요.

**Data condition**

* 로직이 설정한대로 작동하기 위해, 조건을 만들어 필터링을 해줄 수 있어요.
* ex.좋아요를 누른 유저ID 데이터 중, 나와 유저ID가 다른 유저 ID의 데이터에만 액션한다.

**​New data query** ​

* API 요청, 예외 처리, 데이터 가져오기, 새로운 로직 발생 등을 할 때 사용해요.

**To do** ​

* 로직이 설정한대로 작동한 후의 액션을 설정해줄 수 있어요.
* 예시) 푸시가 발송 된 후, 푸시 내역에 저장된다.
* Set after event : To do에서 설정한 액션이 작동된 후, 한번 더 후속 작업이 필요한 경우 사용해요.&#x20;

2024.01.03 Jinny


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ohmyapp.io/main/guide/develop_app/command-execute-function/create-logic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
