On the implementation of H3 BPM database for sorting and fetching data

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.