【已解决】Bex response配置项format如何使用

KOCA版本 :3.4
KOCA模块 :bex引擎
模块版本 :3.4
场景 :
问题 :
报错细节 :
尝试解决方案:

Bex 返回参数的配置项format使用

支持范围

1、字符串格式化
参数type为string
2、日期格式化
参数type为date、java.time.LocalDateTime、java.time.LocalDate
3、数字格式化
参数type为short、integer、long、double、float、decimal、decimal

使用方法

以字符串格式化举例,其它两种类似

参数类型配置为string

比如 <param code="sample" name="示例" type="string"/>

添加格式化的pattern

比如给该返回值添加一个前缀prefix,<param code="sample" name="示例" type="string" format="prefix-{}"/>
如果sample的值是test,最终输出的值为prefix-test

补充数字格式化和日期格式化的使用

日期格式化

参数类型

date、java.time.LocalDateTime、java.time.LocalDate

<param code="sample" name="示例" type="date"/>

添加pattern

比如yyyy-MM-dd HH:mm:ss

<param code="sample" name="示例" type="date" format="yyyy-MM-dd HH:mm:ss"/>

结果sample就是yyyy-MM-dd HH:mm:ss格式

数字格式化

参数类型

short、integer、long、double、float、decimal、decimal
<param code="sample" name="示例" type="double"/>

添加pattern

比如#.##

<param code="sample" name="示例" type="double" format="#.##"/>

最终sample的值就是两位小数格式




加了response之后报错,如何处理

<response type="list"> 加上类型试试