web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

SSRS 2008 R2: Cannot use custom code

(0) ShareShare
ReportReport
Posted on by 605

Hi everyone,

I have an AX2012 SSRS report project. I write the following VB example code in my Custom Code (Report Properties). Then I create a textbox in the report header to use this function and the expression I use there is "=Code.AddValue(1)" for example. But when I compile the project, the call to this method is always giving error (like the method doesn't exist). I need some help with that please, because I need to use Custom Code to control some variables and I don't find any other way (my final goal is to have the pageNumber for every instance of a group, and every new instance means a new page break).

Thank you very much

Marc

Dim values As System.Collections.ArrayList

Function AddValue(ByVal newValue As Decimal)

 If (values Is Nothing) Then

  values = New System.Collections.ArrayList()

 End If

  values.Add(newValue)

End Function

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brandon Ahmad Profile Picture
    2,465 User Group Leader on at

    Awwww....  You are using the "code.addsomemethod" that everyone does outside of AX. In AX, this is not the way to go.  You need to do this as a data method and not try to compile it like you are in native mode.  I'd recommend using C# also.  Thankfully, you can see a video on how to use data methods right here. Watch the last part of the video and you will see how code is added through the data method.  Here is the video:

    [View:https://community.dynamics.com/themes/generic/utility/

  • Marc Puig Profile Picture
    605 on at

    Hi mate, I tried to do it this way in the video, but I couldn't call the data methods inside the report design (in the video, the method is called from the AutoDesign properties, but not inside it in a textbox for example.

    Still looking for a solution.

    Thank you.

  • dolee Profile Picture
    11,279 on at

    Hi Marc,

    "every new instance means a new page break" - are you grouping by some field(s)? If you go to "Group properties" -> "Page Breaks" there is an option to add page break between each instance of a group.

    "have the pageNumber for every instance of a group" - Data method are static, I don't know of a way to work around it to setup variables for each report run. Not sure if there's a work around or not.

    By the way, you *can*use a data method inside a textbox. What kind of errors you are getting?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans