Report Script: Get Field that is not in Report v2: Difference between revisions

No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 87:
While, Calculated Field is able to temporary store the value.
 
*Calculated Field is especially useful when the report needs to calculate the total of result(s).
*:[[Report Script: Simple Calculate Commission by Item UDF Rate|"Simple Calculate Commission by Item UDF Rate" shows how to add '''Group Total''' and '''Grand Total''' with calculated field.]]
*:the total of result(s).<br/>
*Furthermore, designer does not have to worry about the replacement to the control,
*:as the replacement of a label to another control will require only rebinding of data.
 
<br/><br/>
 
==Get project no. from Detail, and show the Project Description as a string with 'comma' separated==
This is an example of how to grab the detail(s) and display as a text on header.
Line 117 ⟶ 118:
if (!string.IsNullOrEmpty(projNoSqlList))
{
//SQL Query that find Description of project that will beis non-repetitive and sorted
DataTable tbl = __report.DBSetting.GetDataTable(
string.Format("SELECT [Description] FROM Project WHERE ProjNo in ({0}) ORDER BY Description"
Line 139 ⟶ 140:
Example of Multiple values in SQL statement:
SELECT [Description] FROM Project WHERE ProjNo in (''''ProjA', 'ProjB'''')
{{Note|The code in BuildSqlProjectRangeIn has not been optimized for performance.<br/>Not suitable for customer whom have more than 100500 details in an Invoice.<br/>
Suggest adding filter to empty ProjNo and distinct the ProjNo before process in the loop.
}}