Skip to main content

Notifications

Small and medium business | Business Central, N...
Suggested answer

GetData and SetData

Posted on by 50

Hi All,

        

I created the code as shown below for setdata and getdata for page no. and for a Heading field for the no. of copies for my report

Shared Offset As Integer
Shared NewPage As Object

Public Function GetGroupPageNumber(NewPage As Boolean, PageNumber As Integer) As Object
If NewPage
Offset = PageNumber - 1
NewPage = False
End If
Return PageNumber - Offset
End Function

Public Function IsNewPage As Boolean
NewPage = True
Return NewPage
End Function

Shared Data1 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
End Function

Public Function SetData(NewData as Object,Group as integer)
If Group =1 and NewData >"" Then
Data1 = NewData
End If
Return True
End Function

Later inserted Textbox in the body with hidden property as shown below

= Code.SetData(Cstr(Fields!ReportTitleCopyText.Value) + Chr(177) +Cstr(Fields!PageCaption.Value),1)

Inserted textboxes in header for dispalying the Header data with each textboxes expression as '=Code.GetData(1,1)  and code.GetData(2,1)

If the Report is for one page I am getting the values of header and pageNo. correctly, but if it is for multiple pages i am getting the header and page numbers wrongly, why this is coming this like for multiple pages and for single page it is coming corretctly, i want to know and i am beginner in the setdata and getdata type of a report, can anyone help me.

Thanks And Ragards,

Satish 

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: GetData and SetData

    Hi,

    You can open the design layout of Report ID 206 and take an idea from there.

    Hope it will help you.

    Thanks.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,113 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans