# `Sp_ReplaceField_Calc_TXT` (procedure)

> 公式语言转换成sql


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sDetail` | `longtext` |
| 2 | IN | `sFormulaGuid` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `longtext` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_ReplaceField_Calc_TXT`'`._

## Narrative

**Business context:** Formula-text rendering helper — given a freeform description `sDetail` and a formula sId from `sisformula`, substitutes every `sisformulacustomizeparam` placeholder (`sName` / `sValue1..sValue21`) into the text so the resulting string reads with concrete values instead of formula tokens. COMMENT `'公式语言转换成sql'`. Sister to `Sp_ReplaceField_Calc` — that one writes into `mftcalcparam`, this one only renders strings.

**What it does:** Loads the column-title map `sColTitleName` from `sisformula` (normalises to a JSON object), counts and cursors `sisformulacustomizeparam WHERE sParentId = sFormulaGuid ORDER BY iOrder DESC`, fetching each row's `sName, sValue, sValue1..sValue21`. Inside the loop `REPLACE`s each `sName` token in `sDetail` with the matching `sValue*` and writes the rendered text out to `sReturn`.

**Invocation:** Status: appears orphaned. Not bound to `gdsmodule.sProcName`, form-master sSqlStr, other routines, or anything in xly-src. Likely intended for inline rendering of formula descriptions in the 报价/工艺 forms but currently not wired up — candidate for maintainer audit.
