Problem:
gets the contents of the child table in the print template, can be Data from the database, and the current project database data in the annual input, but only need to display nearly 3 years of data, plug-in how to achieve sorting data?
Workaround :
1, write a SQL statement directly, the last 3 years after the sorted data read out
2. Loading data in the calling child table interface
3. Example:
var monthly = DateTime.Now.Month;
var selectsql = string. Format (@ "Select
T1. Yearly,
T1. Monthly,
T1. Budgetunitname,
T1. Budgetunitcode,
T1. Budgetitemname,
T1. Budgetitemcode,
T1. Budget
From Xl_ys_budgetpay T1
WHERE t1. Yearly = {0}
--and Monthly > {1}
and T1. Budgetunitcode = ' {2} '
and Budgetitemcode = ' {3} '
ORDER by Monthly ", yearly, Monthly, Budgetunitcode, Budgetitemcode);
var dt = OThinker.H3.WorkSheet.AppUtility.Engine.Query.QueryTable (selectsql);
var list = new list<bizobject> ();
var monthlist = new List<string> {"Jan", "Feb", "Mar", "APR", "may", "June", "Jul", "", "Sep", "Oct", "Nov", "Dec Ember "};
if (dt. Rows.Count > 0)
{
Deptcostbudgetinfo is the name of the child table
Bizobjectschema Childschema = this. ActionContext.Schema.GetProperty ("Deptcostbudgetinfo"). Childschema;
var bizobject = new Bizobject (this. Actioncontext.engine, Childschema, this. ActionContext.User.UserID);
bizobject[" DataType"] = "original";
bizobject["budgetitemname"] = dt. rows[0]["Budgetitemname"]. ToString ();
bizobject["Budgetitemcode"] = dt. rows[0]["Budgetitemcode"]. ToString ();
var bizObject2 = new Bizobject (this. Actioncontext.engine, Childschema, this. ActionContext.User.UserID);
bizobject2[" DataType"] = "modified";
bizobject2["budgetitemname"] = dt. rows[0]["Budgetitemname"]. ToString ();
bizobject2["Budgetitemcode"] = dt. rows[0]["Budgetitemcode"]. ToString ();
for (int i = 0; i < monthlist. Count; i++)
{
Bizobject[monthlist] = dt. rows["Budget"]. ToString ();
Bizobject2[monthlist] = dt. rows["Budget"]. ToString ();
}
List. ADD (Bizobject);
List. ADD (BIZOBJECT2);
}
if (BOS! = NULL)
{
if (BOS. Length > 1)
{
List. AddRange (BOS);
}
}
This. actioncontext.instancedata["Deptcostbudgetinfo"]. Value = list. ToArray ();
ActionContext.InstanceData.Submit ();
On the implementation of H3 BPM database for sorting and fetching data