In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Question:
If you get the contents of the sub-table in the print template, you can get the data from the database, but the data in the current project database is entered annually, but you only need to display the data for nearly 3 years. How can the plug-in sort the data?
Solution:
1. Write a SQL statement directly to read out the data sorted in the past 3 years.
2. Load data when calling the sub-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 ()
Var monthlist = new List {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "December"}
If (dt.Rows.Count > 0)
{
/ / DeptCostBudgetInfo is the child table name
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"] = "modify"
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 ()
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.