본문으로 건너뛰기

단위가 있는 작성값 추가하기

용도

basis.value(...)basis = report.section(...)으로 받은 Section handle의 메서드입니다. Report에 scalar 작성값을 추가하며, 반환된 value handle은 Connected Flow handle의 .bind()에 source로 전달할 수 있습니다.

Report Workbench에서 보이는 것

Report Workbench에서 이름, 값과 unit을 가진 작성값을 추가하는 작업과 같습니다. Connected Flow 편집기에서는 호환되는 public input의 원본 후보로 표시됩니다.

문법

python
basis.value(value_key, value, unit=...)

예제

python
from pipelinexlab import px


report = px.Report("girder_report", title="Girder review")
basis = report.section("design_basis", title="Design basis")

report_span = basis.value(
    "span",
    12.0,
    unit="m",
)

매개변수

이름설명
value_keyReport 전체에서 작성값을 계속 찾는 고유 key
valuebool, signed int64 int, decimal.Decimal, float, str scalar 값
unit값의 단위. Flow input과 연결할 때 type과 함께 검증

반환

작성값을 가리키는 typed value handle을 반환합니다. 이 handle을 Connected Flow handle의 .bind()source로 전달합니다.

규칙

  • value_key는 section이 달라도 같은 Report 안에서 유일하게 정합니다.
  • value의 type과 unit은 연결할 Flow public input 계약과 호환되어야 합니다.
  • intDecimal은 Core가 canonical text로 저장합니다. float는 float64, str은 string을 유지합니다.
  • Decimal("1e-18")처럼 작성할 수 있습니다. from decimal import Decimal로 가져오며, 저장 후에는 exponent나 trailing zero가 없는 표현을 사용합니다.
  • Decimal 작성에는 문서의 computationScale이 적용됩니다. 기존 저장값은 설정 변경으로 다시 반올림되지 않습니다.
  • 같은 value를 서로 다른 Flow input의 원본으로 재사용할 수 있습니다.
  • 값 추가는 계산 Run을 시작하지 않으며 report.save()에서 저장됩니다.

다음 단계