//设置所有字母为大写
var str = ae_a_asset_e$manufacture_code.toUpperCase();
var str2 = ae_a_asset_e$serial_no.toUpperCase();
var str3 = ae_a_asset_e$manu_part_number.toUpperCase();
var str4 = ae_a_asset_e$region_code.toUpperCase();
var str5 = ae_a_asset_e$fac_id.toUpperCase();
知道如何解决这个问题吗?我认为必须有一种方法来表示如果 value = null 那么就不用担心。
最佳答案
首先你必须考虑某些值为null
是否正确,例如ae_a_asset_e$manufacture_code
。
如果它们可以为null
,您可以通过这样的安全方式访问它们(根据需要将此代码扩展到所有其他变量):
var str = ae_a_asset_e$manufacture_code ? ae_a_asset_e$manufacture_code.toUpperCase() : "";
如果它们不能为 null
,那么您应该首先检查数据完整性,然后运行此脚本(假设它们永远不会为 null
)。
关于Pentaho 中的 JavaScript 错误 - 无法调用 null 的方法 "toUpperCase",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48407801/