[英]Dynamic Formula in Crystal Report Formula with winform
I using Visual studio.我使用视觉工作室。
I have SQL table tbInvoice: amount1, amount2, invNumber.我有 SQL 表 tbInvoice:amount1、amount2、invNumber。
In winform, i have checkbox1, checkbox2.在winform中,我有checkbox1,checkbox2。
If checkbox1 is checked, then in CR should be @total = amount1.如果 checkbox1 被选中,那么在 CR 中应该是 @total = amount1。
If checkbox1 and checkedbox2 is checked, then in CR should be @total = amount1 + amount2如果checkbox1 和checkbox2 被选中,那么在CR 中应该是@total = amount1 + amount2
My formula to print :我的打印公式:
frmInv.CrystalReportViewer1.SelectionFormula = "{tbInvoice.invNumber} = '" & FrmInvoice.txtInvNo.Text & "'" frmInv.CrystalReportViewer1.SelectionFormula = "{tbInvoice.invNumber} = '" & FrmInvoice.txtInvNo.Text & "'"
How i accomplish this?我如何做到这一点?
How formula @total in CR can read if checkbox is checked in winform?如果在winform中选中复选框,CR中的公式@total如何读取?
I need something like this in CR @total:我在 CR @total 中需要这样的东西:
if frmInvoice.checkbox1.checked = true and frmInvoice.checkbox2.checked = false then {tbInvoice.amount1}如果 frmInvoice.checkbox1.checked = true 并且 frmInvoice.checkbox2.checked = false 那么 {tbInvoice.amount1}
elseif frmInvoice.checkbox1.checked = true and frmInvoice.checkbox2.checked = true then {tbInvoice.amount1} + {tbInvoice.amount2} elseif frmInvoice.checkbox1.checked = true 和 frmInvoice.checkbox2.checked = true 然后 {tbInvoice.amount1} + {tbInvoice.amount2}
endif万一
Pls Help.请帮忙。 Thank You
谢谢你
I didn't understand your last question but here is an example for the {@YourValue} formula:我不明白你的最后一个问题,但这里是 {@YourValue} 公式的一个例子:
IF {?Your_Parameter} = "ABC" Then {tbInvoice.amount1} ELSE {tbInvoice.amount1} + {tbInvoice.amount2}
Then, simply SUM that formula at whatever level(s) you need.然后,只需在您需要的任何级别对该公式求和。
Your code needs to set the parameter value.您的代码需要设置参数值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.