Collect! Credit and Collection Software™

  Page Table of Contents Related 'How To' Tutorials

How To Use Flags To Control Printing

There may be times when you only want to print certain areas of your report based on criteria that you set. If you cannot use a WHERE clause to get the results you want, you may be able to create a clause using a flag. For instance, let's say you have an Operator Performance Report. As a Manager, you may want to be able to run that report for any operator, but let's say that Operators should only be able to run the report for themselves and Team Leaders can run it for the Operators that they lead.

All of the examples below will use @IF to conditionally allow the logic.

Single Criteria

@tvarUserLevel# = 0

@tvarOperator* = ""

@tvarTeamLead# = 0

@op no total where ( @op.id == @mm.yasoao ) MAX = 1

@tvarUserLevel = @os.ul

@op

//
@if ( @tvarUserLevel = 10 )
// manager can prompt for any operator
@tvarOperator = ? Please Enter an Operator ID. Leave Blank for All.

@elseif ( @tvarUserLevel = 40 )
// extra flag for team leads for query later
@tvarTeamLead = 1

@tvarOperator = @mm.yasoao

@else
// remaining user levels can only see themselves
@tvarOperator = @mm.yasoao

@endif
{Database Query}
{Report Output}

Top of page.

Multiple Criteria

@tvarUserLevel# = 0

@tvarUserType* = ""

@tvarOperator* = ""

// Flag Variables
@tvarManager# = 0

@tvarTeamLead# = 0

//
@op no total where ( @op.id == @mm.yasoao ) MAX = 1

@tvarUserLevel = @os.ul

@ul no total where ( @ul.co = @tvarUserLevel ) MAX = 1

@tvarUserType = @ul.fu

@ul

@op

//
@tvarManager = 1 if ( @tvarUserLevel = 1 )
@tvarManager = 1 if ( @tvarUserLevel = 10 )
@tvarManager = 1 if ( @tvarUserLevel = 20 )
@tvarManager = 1 if ( @tvarUserLevel = 30 )
@tvarManager = 1 if ( @tvarUserLevel = 80 )
@tvarManager = 1 if ( @tvarUserLevel = 85 )
@tvarManager = 1 if ( @tvarUserLevel = 99 )
@tvarManager = 1 if ( @tvarUserType = Manager )
@tvarTeamLead = 1 if ( @tvarUserLevel = 40 )
@tvarTeamLead = 1 if ( @tvarUserType = "Team Leader" )
//
@if ( @tvarManager = 1 )
// manager can prompt for any operator
@tvarOperator = ? Please Enter an Operator ID. Leave Blank for All.

@else
// remaining user levels can only see themselves
@tvarOperator = @mm.yasoao

@endif
{Database Query}
{Report Output}

Top of page.

Summary

Flags are a very useful way to control what is printed in your reports. Many times, the WHERE clause is all that is needed to control the results that are output. However, whenever you want to control the output conditionally, such as report bodies or database queries, then you can use a flag.

Top of page.

Was this page helpful? Do you have any comments on this document? Can we make it better? If so how may we improve this page.

Please click this link to send us your comments: helpinfo@collect.org