Cannot create SetData and GetData without a 'ReportExprHostImpl.CustomCodeProxy' error in Report 10573

Hi all,

I’m new to report writing and am struggling with GetData/SetData.

(I have searched this forum and found things like…/ but these refer to existing setups, not creating a new one)

I am amending Report 10532 ‘Remittance Advce - Entries’. I have already altered 10572 ‘Remittance Advice - Journal’ and we would like 10573 to look more like this. 10572 has a Header, Body and Footer, whereas 10573 just has a Body. So - since I have to use GetData in the Header - I have added the header and footer sections in Visual Studio and copied over the following from 10572:

  • Hidden Header textbox with the Expression =code.SetData(ReportItems!CompanyInfo.Value,1)

  • Hidden Body table with three textboxes, of which 2 and 3 are blank. Textbox 1 is called ‘CompanyInfo’ and has the following values:
    =Fields!CompanyName.Value + Chr(177)

  • Fields!CompanyInfo__VAT_Registration_No__Caption.Value + Chr(177)
  • Fields!CompanyInfo__VAT_Registration_No__.Value + Chr(177)
  • Fields!VendorAddr_1_.Value + Chr(177)
  • Fields!VendorAddr_2_.Value

I then changed the above code to just =Fields!VendorAddr_1_.Value just as a test (this is a valid 10573 DataSet Result for 10573)

When I try to Compile the report I get the error:

Error while validating RDL content:
The Value expression for the textbox ‘textbox33’ contains an error: [BC30456] ‘SetData’ is not a member of ‘ReportExprHostImpl.CustomCodeProxy’.

‘textbox33’ is the Header code =code.SetData(ReportItems!CompanyInfo.Value,1)

I also added a textbox with the GetData code of =code.GetData(1,1) with the intention of pulling through the first line of the Vendor’s address in the format of the working 10572. I get a very similar error but it says GetData not SetData and refers to the relevant textbox. I have since deleted this until I sort out the SetData issue

By the way, am I right in assuming that the ‘,1’ is there to show that the 1st of the three hidden Body textboxes is to be referenced, and that if there were only one, then this would not be needed?

Can anyone explain what I am doing wrong?

Thanks, Paul

Well I may have jsu fixed it. I saw a post referring to Report Properties > Code and looked in the original (10531). It had more code than in 10532 so I cpoied the surplus over to see what happened:

Shared Dim SumPaidForAmount as Decimal
Shared Dim LastPaidForAmount as Decimal

Public Function SetValueToZero()
SumPaidForAmount = 0
End Function

Public Function SetValue(Value as Decimal)
SumPaidForAmount = SumPaidForAmount + Value
End Function

Public Function SetValueTemp()
LastPaidForAmount = SumPaidForAmount
return LastPaidForAmount
End Function

Shared PictureData as Object

Public Function GetPicture() as Object
Return PictureData
End Function

Public Function SetPicture(NewData as Object)
if NewData>""
PictureData = NewData
end if
End Function

Shared Data1 as Object
Shared Data2 as Object
Shared Data3 as Object
Shared Data4 as Object

Public Function GetData(Num as Integer, Group as integer) as Object
if Group = 1 then
Return Cstr(Choose(Num, Split(Cstr(Data1),Chr(177))))
End If

if Group = 2 then
Return Cstr(Choose(Num, Split(Cstr(Data2),Chr(177))))
End If

if Group = 3 then
Return Cstr(Choose(Num, Split(Cstr(Data3),Chr(177))))
End If

if Group = 4 then
Return Cstr(Choose(Num, Split(Cstr(Data4),Chr(177))))
End If
End Function

Public Function SetData(NewData as Object,Group as integer)
If Group = 1 and NewData <> “” Then
Data1 = NewData
End If

If Group = 2 and NewData <> “” Then
Data2 = NewData
End If

If Group = 3 and NewData <> “” Then
Data3 = NewData
End If

If Group = 4 and NewData <> “” Then
Data4 = NewData
End If

End Function

In not sure what this does, but it seems to work!