14.12.2007, 13:56 | #1 |
Участник
|
Query sort field autoSum
Hi,
How can I set AutoSum property on sorting field into Query with x++ I do this into Query Init method but without success. X++: this.query().dataSourceTable(tablenum(LedgerTrans)).sortClear(); this.query().dataSourceTable(tablenum(LedgerTrans)).addSortField(fieldnum(LedgerTrans, Voucher), SortOrder::Ascending); this.query().dataSourceTable(tablenum(LedgerTrans)).addSortField(fieldnum(LedgerTrans, TransDate), SortOrder::Ascending); this.query().dataSourceTable(tablenum(LedgerTrans)).addSortField(fieldnum(LedgerTrans, AccountNum), SortOrder::Ascending); this.query().dataSourceTable(tablenum(LedgerTrans)).autoSum(fieldNum(LedgerTrans, Voucher)); |
|
14.12.2007, 14:51 | #2 |
Участник
|
If you are talking about sum(Field), than it's pretty easy:
X++: this.query().dataSourceTable(tablenum(LedgerTrans)).addSelectionField(fieldNum(LedgerTrans, Voucher), SelectionField::Sum); |
|
14.12.2007, 15:01 | #3 |
Участник
|
Цитата:
See report LedgerTransListAccount/Query/DataSource/LedgerTrans/Sorting/AccountNum-> properties->AutoSum = Yes. Exact this I want to make with X++ , not in AOT. Последний раз редактировалось ist; 14.12.2007 в 15:50. |
|
14.12.2007, 17:34 | #4 |
MCTS
|
ist
First of all, you don't properly use autoSum() method in your example. Look at standard code e.g.: \Classes\ProjReport_CommittedCost\modifyQuery how autoSum() works. Second... Do the way that kashperuk suggested you.
__________________
В глухомани, в лесу Несмотря на красу Дни проводит Лиса Патрикевна. Я никак не пойму Отчего, почему Не пускают куму На деревню |
|
27.03.2008, 16:48 | #5 |
Участник
|
This job try to demonstrate how the SysReportRun class work. And how use AutoSum & AutoHeader parameters.
Settings: 1) Create table "People" with such fields: Surname(str), Salary(EDT-Amount), MyGroup(str) 2) Fill table Notice: - Grand total perform only on the fields derived from Amount (from latest build AmountMST also) - The Print Options dosnt work proper X++: static void Job2(Args _args) { SysReportRun sysReportRun; Args args = new Args(reportstr(SysReportAuto)); People people; SysQueryRun sysQueryRun; Query query = new Query(); QueryBuildDataSource queryBuildDataSource; Report report; ReportDesign reportDesign; ReportAutoDesignSpecs reportAutoDesignSpecs; ReportSection reportSection; Object reportControl; ReportRealControl reportRealControl; ; //Init reportRun sysReportRun = classfactory.reportRunClass(args); sysReportRun.init(); //Setup group total field(s) with autoSum and autoHeader queryBuildDataSource = query.addDataSource( tablenum(people) ); queryBuildDataSource.addSortField( fieldnum(people, Salary) ); queryBuildDataSource.autoSum(1, true);//Autosum for 1st sort field queryBuildDataSource.addSortField( fieldnum(people, MyGroup) ); queryBuildDataSource.autoHeader(2, true);//AutoHeader for 2nd sort field //Init queryRun on reportRun sysQueryRun = new SysQueryRun( query ); sysQueryRun.promptLoadLastUsedQuery( false );// use created queryRun sysReportRun.queryRun( sysQueryRun ); //Setup and create repor design report = sysReportRun.report(); report.query(sysReportRun.queryRun().query()); reportDesign = report.design(); reportDesign.caption( 'Test for people' ); reportDesign.reportTemplate( 'FrontPage' ); reportAutoDesignSpecs = reportDesign.autoDesignSpecs(); // Add section and fields on the report reportSection = reportAutoDesignSpecs.addSection(ReportBlockType::Body, people.TableId); reportControl = reportSection.addControl(people.TableId, fieldnum(people, Name)); reportControl = reportSection.addControl(people.TableId, fieldnum(people, MyGroup)); reportControl = reportSection.addControl(people.TableId, fieldnum(people, Salary)); reportRealControl = reportControl; //calculate grand total on this field reportRealControl.sumAll( true ); reportAutoDesignSpecs.grandTotal( true ); //Block form usage sysReportRun.queryRun().query().interactive( false ); report.interactive( false ); //Setup print options: //Print ranges, print totals only, print grand total, remove...repetitive, remove ...identical sysReportRun.printRemoveRepeatedHeaders(true); sysReportRun.buildPrintRemoveRepeatedHeaders(); sysReportRun.run(); } Последний раз редактировалось Volodymyr; 27.03.2008 в 16:52. |
|
|
За это сообщение автора поблагодарили: mbal (1). |
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|