使用JS写图表标籤

var a = FR.remoteEvaluate('=sql("MING","select rank from (select c.vendor_name_alt vendor,sum(decode(a.set_of_books_id,2001,1,31)*nvl(b.base_amount,b.amount))/1000 amt,ROW_NUMBER() OVER (ORDER BY sum(decode(a.set_of_books_id,2001,1,31)*nvl(b.base_amount,b.amount))/1000 DESC) AS rank from ap_invoices_all a,ap_invoice_distributions_all b,po_vendors c where a.invoice_id=b.invoice_id and a.vendor_id=c.vendor_id and a.set_of_books_id=2001 and b.line_type_lookup_code=\'ITEM\' and b.dist_code_combination_id in (4231,4051) and to_char(a.invoice_date,\'yyyy\')=to_char(sysdate,\'yyyy\') and to_char(a.invoice_date,\'yyyymm\')<=to_char(sysdate,\'yyyymm\') group by c.vendor_name_alt order by amt desc) where vendor = this.category",1,1)');

function(){ return this.category+":"+a}

以上是我的标籤自定义SQL,请问下方function内的this.category可以放进sql里面当作条件判断吗,像我sql最后方写的一样

可以的话要怎麽写,像我那样写的话是没有值的

image.png

像我那样写悬浮了是没有提示的

FineReport 帆软用户wWTsbARVa9 发布于 2025-1-13 11:43
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
snrtuemcLv8专家互助
发布于2025-1-13 11:45(编辑于 2025-1-13 11:46)

需要放到function(){ }内,拼接也有问题

function(){ 

var a = FR.remoteEvaluate('=sql("MING","select rank from (select c.vendor_name_alt vendor,sum(decode(a.set_of_books_id,2001,1,31)*nvl(b.base_amount,b.amount))/1000 amt,ROW_NUMBER() OVER (ORDER BY sum(decode(a.set_of_books_id,2001,1,31)*nvl(b.base_amount,b.amount))/1000 DESC) AS rank from ap_invoices_all a,ap_invoice_distributions_all b,po_vendors c where a.invoice_id=b.invoice_id and a.vendor_id=c.vendor_id and a.set_of_books_id=2001 and b.line_type_lookup_code=\'ITEM\' and b.dist_code_combination_id in (4231,4051) and to_char(a.invoice_date,\'yyyy\')=to_char(sysdate,\'yyyy\') and to_char(a.invoice_date,\'yyyymm\')<=to_char(sysdate,\'yyyymm\') group by c.vendor_name_alt order by amt desc) where vendor = \''+this.category+'\'",1,1)');

return this.category+":"+a;

}

  • 2关注人数
  • 25浏览人数
  • 最后回答于:2025-1-13 11:46
    请选择关闭问题的原因
    确定 取消
    返回顶部