August 29, 2011 at 12:48 pm
Hi,
I've added a VB function to my report in the Custom Code area. The function is defined like this:
Public Function ExpandPrice(ByVal Price As Double, Optional ByVal pSeparator As String = ".") As String
(with a lot more code of course)
When I edit a textbox on the report and set the value expression like this:
=Code.ExpandPrice(Fields!TotalReceived.Value)
The ExpandPrice is underlined in red as if there is an error with it. The report deploys and runs, but nothing is displayed where this textbox is.
This is my first time trying anything like this, does anyone have any idea what I am doing wrong?
August 29, 2011 at 1:54 pm
Typically when I start working with custom code I don't try biting off the whole thing at once. Inevitably you miss something small and nothing works and it takes more time to debug than to just get it working slowly and gradually. So that being said, try something easy. Keep your same function declaration, but replace all the code indside with something very simple, maybe just pass the value from the parameter back out the return and then call it the same way and see if you get anything. Then slowly build the function up and test iteratively making sure it continues to work.
I am pretty sure the red line when calling your code from the textbox always happens.
Good luck,
Steve
August 29, 2011 at 2:12 pm
The red squigle always appears when using embedded code. I would try Steve's advice, simplify the embedded code so you know you will get an answer, and then build up from there.
August 30, 2011 at 5:49 am
Thanks Steve & Daniel,
I had copied this code from a web site where people had said that it worked, but I will follow your advice, I was most concerned about the red squiggly line meaning I had done something wrong.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply