Question

What's the difference between Detail.Visible = False and LayoutAction = LayoutAction.NextRecord if the intention is to skip a row conditionally?

Was it helpful?

Solution

Excellent question! The LayoutAction property is a way to control both the navigation through the record and the layout of the section on the page. Under normal circumstances, without modifying LayoutAction setting, during the processing of each record three actions are taken (on the left is the name of the LayoutAction enum value, on the right is a description in my own words):

  1. PrintSection: Print the current section details in the current location on the page.
  2. MoveLayout: Move the layout to the next position, so that the next record will print in the next position and not on top of the current one.
  3. NextRecord: Move the record cursor/pointer to the next record. Again, so that the next instance of the section will be bound to the next record.

So normally, if you don't mess with the LayoutAction property, all three actions are taken. The LayoutAction property allows you to prevent any of those actions from happening.

Frankly speaking though, this is left over from the old days and was used to solve very complex layout scenarios. For example, in the ActiveReports-ActiveX days in VB6 we used it (along with some very sophisticated code) to print a data-bound calendar. Since these days there are calendar controls you can embed into the reports, and ActiveReports includes many other sophisticated layout settings LayoutAction is pretty much never used.

Obviously, the Section's Visible property just hides the section and doesn't take up space for it (so it doesn't move layout and it doesn't print it). Generally Visible is useful LayoutAction isn't.

OTHER TIPS

i'm setting LayoutAction but it seems to not work.

LayoutAction = 7

ERROR: (ActiveReport) 5800: Source: Report , Event: OnFetchData , Line number: 564 Description:Variable is undefined: 'LayoutAction'

and

Me.LayoutAction = 7

gives

ERROR: (ActiveReport) 5800: Source: Report , Event: OnFetchData , Line number: 564 Description:Object doesn't support this property or method: 'Me.LayoutAction'

i'm using vbscript activereports 2 "embedded" in an ERP application (Agresso 5.5)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top