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 report custom code not recognized

(0) ShareShare
ReportReport
Posted on by 455

Hello Community

I wrote a simple function in the Code property of the ssrs report and trying to call it from one of the expressions on row Visibility property but it is giving me error when I build or deploy the report

<Function_Name> is invalid: InvalidIdentifier

I checked the syntax look for any typo but everything seems to be fine but still I am not able to get pass this error. Any Idea why It is doing this?

*This post is locked for comments

I have the same question (0)
  • syed baber Profile Picture
    11,633 on at

    Hi Samy,

    Can you please let me know what you are trying to achieve? May be there is a way to write that code in X++ and utilize that in SSRS report expression.

    Thanks,

    Baber.

  • Samy123 Profile Picture
    455 on at

    this the VB code in code section:

    Public Function IsFieldMissing(field as Field) as Boolean

    If(field.IsMissing) Then

    Return True

    Else

    Return False

    End If

    End Function

    This is the expression on the row Hidden property"

    IIF(code.IsFieldMissing(Fields!BackOrder),True, False)

  • Sohaib Cheema Profile Picture
    49,443 User Group Leader on at

    VB code is no more supported in AX2012-SSRS

    tell us what you want to achieve

  • Suggested answer
    Martin Dráb Profile Picture
    237,996 Most Valuable Professional on at

    You can't do that in AX reports, AFAIK. In your case, you can easily use an expression alone.

    If you need something more complex, create a data method.

  • Samy123 Profile Picture
    455 on at

    Martin and Sohaib,

    The reason I am doing this, is because of an exception that we get occasionally that says that the hidden property reference a field that is not exists in the dataset. I googled out and someone suggested this solution to use VB function IsMissing() to check for the missing field at run-time they suggested me to write this function in code section and reference it in your expression. That way if for some reason the field is not included in the dataset at runtime the SSRS will not throw the ugly internal server error infolog to the user.

    Actually its a TechNet article

    https://technet.microsoft.com/en-us/library/cc281297(v=sql.100).aspx

  • Verified answer
    syed baber Profile Picture
    11,633 on at

    Hi Samy,

    Rather than writing a VB function to check this, I would suggest you to try resolving the issue from SSRS or AX client by doing the following steps:

    1) Clear cache from Tools -> Cache options.

    2) Do full CIL.

    3) In Visual Studio, select the report dataset, copy the query and then remove it, then refresh dataset. All fields should disappear. Now put the query back again and refresh dataset. See if the new field now showing under the dataset or not.

    4) If you are still getting the error, then send me the project XPO and I will verify it on my demo environment.

    Thanks,

    Baber.

  • Sohaib Cheema Profile Picture
    49,443 User Group Leader on at

    But writing VB Functions/scripts on Code window is not supported in AX-SSRS

    you have choice to write same thing as your are writing in VB code as under

    =Code.IsFieldMissingThenString(Fields!FieldName,"Missing")

    or as following

    =Code.IsFieldMissing(Fields!FieldName).

    This should be written in TEXTBox Expressions

    Have a look here

  • Suggested answer
    Kanagaraj A Profile Picture
    1,254 on at

    Hi samy,

    " This is the expression on the row Hidden property"

    IIF(code.IsFieldMissing(Fields!BackOrder),True, False) "

    Try below for this <Function_Name> is invalid: InvalidIdentifier -  error

    please copy and paste the below code:

    IIF(code.IsFieldMissing(Fields!BackOrder.VALUE),True, False)

  • Verified answer
    Samy123 Profile Picture
    455 on at

    Baber, I did what you suggested. Lets see if they again hit it or not. The problem is that its occasional the same field SSRS doesn't complain most of the time.

    Sohaib yes I followed this article. So are you saying that Microsoft doesn't support adding VB code to the code section anymore in SQL server 2012 ssrs ? then why its there in the first place?

    No Raj it dint work same error.

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