Announcements
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
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.
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)
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
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.
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
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.
VB code is no more supported in AX2012-SSRS
tell us what you want to achieve
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)
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.
André Arnaud de Cal...
294,081
Super User 2025 Season 1
Martin Dráb
232,860
Most Valuable Professional
nmaenpaa
101,158
Moderator