Error: SSRS/EP error when the return type in display method is incorrect – Dynamics AX 2012
When you work with data sources through a query in EP/SSRS you might land up in this error “Data or calculated fields with type “Record” are not supported”.
How do i resolve ?
One of the tables that is being used in the data source has a display method with a return type as “record”. Scan through all the display methods and find the one that has the display keyword but still returns a type record in the signature. In our case we had a method similar to this
Public display inventTable getInventTable() { return InventTable::find(this.itemid); }
Why does this happen ?
It is illegal to use a display keyword for a method that returns any complex object like “Container”, “Record”, “Class”. The reason we don’t find it inside AX is because compiler doesn’t validate it and it can be deducted only at run time. So say you have you a display method as in the example above but you never use it then AX never complains about it.
When these tables are accessed through Query in SSRS, SSRS tries to run through the list of display methods to show up in the field selection. Since SSRS cannot comprehend the return type it throws this error.
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: No row message in Dynamics Ax SSRS 2012 (kamalblogs.wordpress.com)
- SSRS Tip: Using invisible parameters in contracts – Dynamics AX 2012 (kamalblogs.wordpress.com)
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012 (kamalblogs.wordpress.com)
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012 (kamalblogs.wordpress.com)
Productivity tip: Do you need the under score when naming – Dynamics Ax
Well When we sat through the product review there was one simple point that caught our attention, surprisingly it helped us improve our productivity. This post is to share on what we learnt.
Typically i have seen several implementation and product development teams adopting the ‘_'(underscore) naming convention. In fact we followed it through out Dynamics AX 2009. Though at the very first look it appears helpful in hindsight it deters productivity.
How ?
1. While you type holding a shift key is not making typing faster.
2. Every time you declare a variable you are again held up with underscores
3. On the AOT node navigating is definitely not easier.
If you look all these points at a component level it can be ignored but when you do it over and over it adds up to a significant time.
Next time you start a new project or product consider if you need to use the underscore ‘_’ again.
Related articles
- SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012 (kamalblogs.wordpress.com)
- SSRS tip: How to set the page size for a SSRS report in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: No row message in Dynamics Ax SSRS 2012 (kamalblogs.wordpress.com)
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012 (kamalblogs.wordpress.com)
Producvity tip: Don’t scroll use Ctrl + G in your Editor – Dynamics Ax
The other day as i was reviewing a code modification to a long method from my team mate he had to walk me up and down through the code scrolling.
Just then the Ctrl + G flashed in me. Yes It takes a lot less effort to type in the line number then scrolling up and down. Even if you are not sure of the line number make it a guess then it is always a few lines up or down.
If you are newbie here is how you can find the line number
On AX 2009
You can identify the line number in the status bar.
On AX 2012
Activate the toggle line number in the tool bar or identify the line number from the status bar
Best practice
Ideally keeping best practices in mind you must right methods that have limited number of lines and break them and keep it modular.
SSRS Tip: Prevent report execution through controller – Dynamics Ax 2012
What a user might hate to see is a blank report. No matter where the mistake lies the earlier we react the happier the user is. Here today i’m sharing a tip on how you could stop/warn/show a info after the report execution is initiated after the user clicks the “Ok” button in the dialog.
In the example discussed here, the idea is to check preemptively if a query will return a record or not. If no then the report aborts execution.
To implement this, open the controller of your report or create one.
On the controller class, override the method “preRunValidate”
Place the code as shown here. This method is invoked after the user clicks the “Ok” button and before the report is executed. Do not block the super call in this method as it does few other important validations. This method can return an error/warning/info. If it is a warning or error the report aborts further execution.
protected container preRunValidate() { container validateResult = super(); Query firstQuery; int recordcount; firstQuery = this.getFirstQuery(); custStatementCount = QueryRun::getQueryRowCount(firstQuery, 6); if (custStatementCount > 5) { validateResult = [SrsReportPreRunState::Error, "No valid records found for the specified range"]; } return validateResult; }
Standard recommends the method to be used for validating if the report returns a large amount of data.For reference see \Classes\CustAgingReportController\preRunValidate\
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012
- SSRS Tip: Using labels for dynamic texts in SSRS reports – Dynamics Ax 2012
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012
- SSRS tip: How to set the page size for a SSRS report in Dynamics Ax 2012
- SSRS tip: No row message in Dynamics Ax SSRS 2012
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012
SSRS Tip: Printing Row headers in every page – Dynamics Ax 2012
This post today will discuss how to print row headers in every page for tablix.
When your table has a header
When using table type tablix with headers as seen in the below image, right click on the Tablix properties and select “Repeat header rows on each page” (If you use a matrix control please check the same for “Repeat header columns on each page”)
When you use a static tablix member in Row or Column.
If you don’t realize what a static tablix member, select a table and insert a row using the option “Outside Group – Above” or simply Insert Row -> Above if you don’t have any groupings. Now open the Group mode window (if not open, click the grouping icon from your report tool bar ) and then click Advanced mode. The system will show up static members in a table. These are members that are calculated once and are rendered in one or multiple pages. These controls can also be used like headers.
Coming back, Once you have identified the static tablix member you want to repeat, On the property of the tablix member set “RepeatOnNewPage” to True. (If this doesn’t work outright, try setting the property “KeepWithGroup” to “After”)
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- SSRS tip: No row message in Dynamics Ax SSRS 2012 (kamalblogs.wordpress.com)
- SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS Tip: Using labels for dynamic texts in SSRS reports – Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: How to set the page size for a SSRS report in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012 (kamalblogs.wordpress.com)
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS Tip: Using invisible parameters in contracts – Dynamics AX 2012 (kamalblogs.wordpress.com)
Dev Tip: Activating document handling for inquiry(read only) forms – Dynamics Ax 2012
This post will explain how document handling can be activated only for specific tables or for all tables.
Activate document handling for selective tables.
To activate document handling for selective tables.
Go to Organization administration -> Setup -> Document management -> Document management parameters
Check the flag “Use active document tables”
Once specified here then document handling is active only for selective list of tables. To specify the active list of tables go to Organization administration -> Setup -> Document management -> Active document tables. Document handling is now only enabled for the selected tables in a controlled mode.
Activate document handling for all tables.
Simply unchecking the “Use active document tables” in Document management parameters makes it activate for all tables. There is a limitation here, in the case where document handling is enabled for all tables the system verifies if the table has edit/delete permission. Only if it is the case document handling is activated otherwise it is disabled. E.g This means tables like Salestable/Salesline will have permission to add/edit documents while forms that uses tables like custInvoiceJour, vendinvoice jour will have document handling disabled.
User’s may ask for document handling to be activated on these read only forms. In these case there is a way out.
Go to Organization administration -> Setup -> Document management -> Active document tables and enter the table name, say “VendInvoiceJour” also make sure to check the “Always enabled” flag. This is very important since this means the document handling is enabled irrespective of the table permission. So this way you can activate document handling for read only tables
\Forms\DocuView\Methods\doReSearch – Go to this method
on line Number: 130 – add the following line,
allowEditBasedOnActualForm = true
Setting this will enable you to use the full document handling feature even for read only forms.
SSRS Tip: Using invisible parameters in contracts – Dynamics AX 2012
There can be cases where you wanted a contract in the attribute but do not want the UI builder to expose it to the user. The reporting framework in AX provides a very easy way to incorporate this.
Open the parm method in the contract that you don’t want to expose. Add the attribute shown here along with other attributes. This attribute when found in the parm method will automatically prevent the UI builder from adding this to the dialog.
[DataMemberAttribute, SysOperationControlVisibilityAttribute(false)] public LogisticsAddressing parmAddress(LogisticsAddressing _address = companyAddress) { companyAddress = _address; return companyAddress; }
This feature comes as a part of the BOF, see here http://j.mp/185ufd2
Update: Apologize for the wrong statement here. The only way to make a parameter visible when using the contract with reporting framework is to specify it in the design. This is because the contract class \Classes\SrsReportRdpDataContractInfo\buildMemberAndNestedObjectMap – 29 ignores this attribute and reads the design RDL (created using your VS) to decide if a parameter must be visible in the contract. So to hide your parameter open the parameters node in Visual studio and then set the visibility property to hidden.Also a point to understand is that the VS design overrides any specifications at the contract level for properties like LableHelp, Visibility, grouping, HelpText, value type (multivalue) etc. (Ref: \Classes\SrsReportRdpDataContractInfo\fillReportDesignProperties). Thanks to a AXForum member who pointed this out.
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012
- SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012
- SSRS tip: No row message in Dynamics Ax SSRS 2012
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012
- SSRS tip: How to set the page size for a SSRS report in Dynamics Ax 2012
- SSRS Tip: Using labels for dynamic texts in SSRS reports – Dynamics Ax 2012
- Microsoft Dynamics AX Architecture (teamaxapta.wordpress.com)
SSRS Tip: Using labels for dynamic texts in SSRS reports – Dynamics Ax 2012
Dynamic text in the reports makes them more readable and meaningful. In this article we will see how we can use labels from AX to construct your dynamic text. The string format option comes handy to help us do this.
Here is how you must specify a string text with labels in it.
Open the report control properties and on the property “Value”, select the expression option and place your text in the format seen here.
=System.String.Format(“This is a label id converted at run time {0}”, Lables!@SYS1560);
You can also use report or data base fields like Fields!CustTable.Value to construct your Dynamic text.
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012 (kamalblogs.wordpress.com)
- SSRS tip: How to set the page size for a SSRS report in Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS tip: No row message in Dynamics Ax SSRS 2012 (kamalblogs.wordpress.com)
SSRS Tip: Speed up RDP based SSRS reports testing in Dynamics Ax 2012
When working on precision designs a lot of time is spent on waiting for the preview to run. If your precision design uses an RDP dataset here is a simple and fantastic tip to speed up.
1. Convert your temporary table to persistent by modifying the TableType property to Regular
2. Now run the report once. Either from Visual studio or inside Ax. This fills the data in the temporary table.
3. Comment the code inside processreport method or simply write a “return” statement on the first line of the method.
That’s it. you are now geared for a faster execution of the reports. Remember to revert back once you are done or wait for the testers to find it 🙂 but don’t let it go to the production.
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012 (kamalblogs.wordpress.com)
- Project creation tool for extended classes – Dynamics Ax 2012 (kamalblogs.wordpress.com)
- SSRS : RDP class & Debug it (axchaitu.wordpress.com)
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012 (kamalblogs.wordpress.com)
- SSRS tip: How to set the page size for a SSRS report in Dynamics Ax 2012 (kamalblogs.wordpress.com)
SSRS tip: No row message in Dynamics Ax SSRS 2012
Some sections in your report may not have data but the header sections might print. In these cases to make it informative for the user a “No data available” message might be helpful since the user is then assured that there is no data for that particular data section. This tip will guide you on how to setup “No data available”.
Select the Tablix/List/Matrix control where you want the message to be available and open the properties window, Find the property “NoRowsMessage”. This property can be filled in with text or for dynamic text using expressions. Type in something like “No data available”
When there is no data for that particular section SSRS automatically prints the text under “NoRowsMessage”
For more tips and learning about SSRS – AX 2012 order the book Dynamics AX 2012 Reporting Cookbook authored by me.
Related articles
- Dynamics Ax 2012 reporting cookbook for SSRS – Dynamics Ax 2012 (kamalblogs.wordpress.com)
- Dev tip: Finding if a range is specified in a query – Dynamics Ax (kamalblogs.wordpress.com)
- SSRS tip: Take care that VS and AX client are in the same layer for SSRS – Dynamics AX 2012 (kamalblogs.wordpress.com)
- Infographic: The Physical Size of Big Data (domo.com)