# 초기 값 및 계산 적용 순서

라인 아이템 추가 및 값 변경 시 계산 수식, 수식 필드, 데이터 소스 등 적용되는 순서입니다.

### 라인 아이템 추가 시

```mermaid
---
config:
  theme: base
  themeVariables:
    primaryColor: '#162134'
    primaryTextColor: '#fff'
    primaryBorderColor: '#fff'
    lineColor: '#FFC15A'
    secondaryColor: '#162134'
    tertiaryColor: '#fff'
    fontFamily: Inter, Pretendard
    fontSize: 10.5pt
---
flowchart TD
 subgraph s1["비즈니스 규칙"]
        n3["비즈니스 규칙: 객체"]
        n4["비즈니스 규칙: Apex"]
  end
 subgraph s2["비즈니스 규칙 실행 후 프로세스"]
        n16["수식 계산"]
        n17["수식 필드 재계산"]
        n18["할인율 재할당 및 계산"]
        n19["필수, 읽기 전용 제어"]
  end
    A(["조회 선택기에서<br>라인 아이템 레코드 추가"]) ==> B["기본값 할당"]
    B ==> C["소스 필드 할당"]
    C ==> n2["초기화 이벤트에 대한<br>비즈니스 규칙이 있는가?"]
    n2 == 있음 ==> n3
    n3 ==> n4
    n4 ==> n7["기간 계산"]
    n7 ==> n8["수식 계산"]
    n2 -. 없음 .-> n7
    n8 ==> n9["수식 필드 평가"]
    n9 ==> n10["할인율 계산기에<br>할인율 적용"]
    n10 ==> n11["필수, 읽기 전용 제어 평가"]
    n11 ==> n12["로드 시 이벤트에 대한 <br>비즈니스 규칙이 있는가?"]
    n12 -. 없음 .-> n13["요약 계산"]
    n12 == 있음 ==> n16
    n13 ==> n14["자동넘버가 활성화 된 경우<br>자동넘버 재할당"]
    n14 ==> n15(["라인 아이템 레코드 추가 완료"])
    n16 ==> n17
    n17 ==> n18
    n18 ==> n19
    n19 ==> n13
    n16@{ shape: rect}
    B@{ shape: rect}
    n2@{ shape: diam}
    n12@{ shape: diam}
    style s1 fill:#fafaf9
    style s2 fill:#fafaf9
```

### 필드값 변경 시

```mermaid
---
config:
  theme: base
  themeVariables:
    primaryColor: '#162134'
    primaryTextColor: '#fff'
    primaryBorderColor: '#fff'
    lineColor: '#FFC15A'
    secondaryColor: '#162134'
    tertiaryColor: '#fff'
    fontFamily: Inter, Pretendard
    fontSize: 10.5pt
---
flowchart TD
 subgraph s1["비즈니스 규칙"]
        n3["비즈니스 규칙: 객체"]
        n4["비즈니스 규칙: Apex"]
  end
    n2["변경 이벤트에 대한 비즈니스 규칙이 있는가?<br>그리고<br>규칙 평가 대상 필드인가?"] == 있음 ==> n3
    n3 ==> n4
    A(["필드값 변경"]) ==> n2
    n4 ==> n5["변경된 필드 유형"]
    n5 == 숫자 또는 통화 ==> n7["수식/할인율 계산"]
    n7 ==> n11["수식 필드 재계산"]
    n2 -. 없음 .-> n5
    n11 ==> n12["요약"]
    n12 ==> n13(["필드값 변경 완료"])
    n5 == 날짜 ==> n14["기간 계산"]
    n14 ==> n15["수식 필드 재계산"]
    n5 == 그 외 ==> n15
    n15 ==> n13
    n2@{ shape: diam}
    n5@{ shape: diam}
    n11@{ shape: rect}
    style s1 fill:#fafaf9
```

### 기본 화면 로드 시

### 라인 아이템 저장 시


---

# 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://help.smallbuilder.com/ko/smallbuilder-line-items/line-item-editor/calculation-order.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.
