在我的脚本中,我试图从DB中获取记录列表
KEYWORD Collections . Log List ${query_results}
Documentation:
Logs the length and contents of the list using given level.
Start / End / Elapsed: 20180306 20:49:59.894 / 20180306 20:49:59.894 / 00:00:00.000
20:49:59.894 INFO List length is 20 and it contains following items:
0: ('3/6/2018', 6, 3, ' 50.00', 984, 286, 29.07)
1: ('3/5/2018', 6, 4, ' 66.67', 984, 866, 88.01)
2: ('3/4/2018', 6, 4, ' 66.67', 984, 976, 99.19)
3: ('3/3/2018', 6, 4, ' 66.67', 984, 884, 89.84)
4: ('3/2/2018', 6, 4, ' 66.67', 984, 864, 87.8)
5: ('3/1/2018', 7, 5, ' 71.43', 1848, 1440, 77.92)
6: ('2/28/2018', 6, 4, ' 66.67', 1656, 1248, 75.36)
7: ('2/27/2018', 6, 4, ' 66.67', 1656, 1248, 75.36)
8: ('2/26/2018', 6, 1, ' 16.67', 1656, 1248, 75.36)
9: ('2/25/2018', 6, 1, ' 16.67', 1656, 1056, 63.77)
10: ('2/24/2018', 8, None, None, 816, 80, 9.8)
11: ('2/23/2018', 11, 3, ' 27.27', 1464, 128, 8.74)
12: ('2/22/2018', 11, 7, ' 63.64', 2232, 1292, 57.89)
13: ('2/21/2018', 11, 2, ' 18.18', 2232, 1239, 55.51)
14: ('2/20/2018', 11, None, None, 2232, 184, 8.24)
15: ('2/19/2018', 6, None, None, 1752, 0, 0)
16: ('2/18/2018', 6, None, None, 528, 0, 0)
17: ('2/17/2018', 6, None, None, 528, 0, 0)
18: ('2/16/2018', 7, None, None, 1680, 0, 0)
19: ('2/15/2018', 6, 2, ' 33.33', 1584, 93, 5.87)
正如您所看到的,有些数据是无(它们是来自DB的NULL值)。我想将这些数据替换为0.00。我不确定如何在Robot Framework中执行此操作。有人可以帮助我实现这个目标吗?
答案 0 :(得分:1)
感谢A.kootstra的想法。
我没有在Robot Framework级别处理这个问题,而是能够在SQL Query中使用Oracle函数来处理这个问题。
i.e. nvl(to_char(mycolumn), '0') This Replaces NULL to desired value