行表达式

展开 层次号 标签

      行表达式
        1  示例
            1.1  行计算
                1.1.1  数字
                    1.1.1.1  数据行号
行表达式
#{数据行号}
                    1.1.1.2  表行号
行表达式
#{表行号}
                    1.1.1.3  数学计算
行表达式
Math.abs(#{数字列1}) + Math.PI * Math.sqrt(#{数字列2})
                    1.1.1.4  包含统计值的计算
行表达式
#{数字列1} - #{数字列2-均值}
                1.1.2  字符串
                    1.1.2.1  字符串长度
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.length
else
    -1
                    1.1.2.2  替换
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.replace(/hello/ig,'Hello')
else
    null
                    1.1.2.3  小写
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.toLowerCase()
else
    null
                    1.1.2.4  分割
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.split(',')
else
    null
                    1.1.2.5  子串位置
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.indexOf('今来花似雪')
else
    -1
                    1.1.2.6  替换首个
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.replace("敲门", "推门");
else
   null
                    1.1.2.7  替换所有
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.replace(/怨年华/g, "鸟惊心");
else
   null
                    1.1.2.8  包含子串
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.search(/昔去雪如花/ig)
else
    -1
                    1.1.2.9  特定值
行表达式
var array = [ 'A', 'B', 'C', 'D' ];
array.includes(#{字符串列})
                1.1.3  时间
                    1.1.3.1  格式
行表达式
function formatDate(date) {
     var y = date.getFullYear();
     var m = date.getMonth() + 1;
     m = m < 10 ? ('0' + m) : m;
     var d = date.getDate();
     d = d < 10 ? ('0' + d) : d;
     var h =date.getHours();
     h = h < 10 ? ('0' + h) : h;
     var M =date.getMinutes();
     M = M < 10 ? ('0' + M) : M;
     var s =date.getSeconds();
     s = s < 10 ? ('0' + s) : s;
     return y + '-' + m + '-' + d + ' ' + h + ':' + M + ':' + s;
}
if (#{时间列} != null)
   formatDate(new Date(#{时间列}));
else
   null;
                    1.1.3.2  
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getFullYear()
else
    null
                    1.1.3.3  
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getMonth() + 1
else
    null
                    1.1.3.4  
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getDate()
else
    null
                    1.1.3.5  
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getHours()
else
    null
                    1.1.3.6  
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getMinutes()
else
    null
                    1.1.3.7  
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getSeconds()
else
    null
                    1.1.3.8  星期
行表达式
if ( #{时间列} != null ) 
    new Date(#{时间列}).getDay()
else
    null
            1.2  行过滤
                1.2.1  数字
                    1.2.1.1  列值不是数字
行表达式
isNaN(#{某列} - 1)
                    1.2.1.2  比较数字
行表达式
#{数字列1} != 0 || #{数字列1} < #{数字列2}
                    1.2.1.3  比较统计值
行表达式
#{数字列} < #{数字列-均值}
                1.2.2  时间
                    1.2.2.1  列值的时间值
行表达式
if (#{时间列} != null)
   new Date(#{时间列}.getTime()
else
   -1;
                    1.2.2.2  时间点
行表达式
#{时间列} == '2016-05-19 11:34:28'
                    1.2.2.3  匹配时间
行表达式
if (#{时间列} != null)
   #{时间列}.startsWith('2016-05-19 09')
else
   undefined;
                    1.2.2.4  比较时间
行表达式
if (#{时间列} != null)
   new Date(#{时间列}).getTime()  > new Date('2016/05/19 09:23:12').getTime()
else
   undefined;
                    1.2.2.5  格式化时间
行表达式
function formatDate(date) {
     var y = date.getFullYear();
     var m = date.getMonth() + 1;
     m = m < 10 ? ('0' + m) : m;
     var d = date.getDate();
     d = d < 10 ? ('0' + d) : d;
     var h =date.getHours();
     h = h < 10 ? ('0' + h) : h;
     var M =date.getMinutes();
     M = M < 10 ? ('0' + M) : M;
     var s =date.getSeconds();
     s = s < 10 ? ('0' + s) : s;
     return y + '-' + m + '-' + d + ' ' + h + ':' + M + ':' + s;
}
if (#{时间列} != null)
   formatDate(new Date(#{时间列}));
else
   null;
                    1.2.2.6  是否为星期日
行表达式
if (#{时间列} != null)
   new Date(#{时间列}).getDay() == 0
else
   undefined;
                1.2.3  字符串
                    1.2.3.1  列值为empty
行表达式
#{字符串列} == ''
                    1.2.3.2  列值不为null
行表达式
#{字符串列} != null
                    1.2.3.3  比较
行表达式
#{字符串列} === '只恐夜深花睡去'
                    1.2.3.4  开始于
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.startsWith('君不见')
else
   undefined
                    1.2.3.5  结尾于
行表达式
if ( #{字符串列} != null ) 
    #{字符串列}.endsWith('需尽欢')
else
   undefined