Developer ToolsFree generatorPDF, Excel, Word exportInfor LNAll Infor LN and Baan tools

Infor LN Report Script Template Generator

This generator writes a report script for an Infor LN 10.x report: declaration, before.program and after.program, header and detail layout sections, a condition that suppresses a detail line and a running total. Report scripts are the classic way to add logic to an LN report when the program script cannot be changed.

Fill in

Generated code
Download:

Header and declaration

|******************************************************************************
|* Report script for tdsls440101000
|* Author: AJ
|******************************************************************************
declaration:

	table	ttdsls401

	double	total.qoor
	long	lines.printed

Program sections

before.program:
	| runs once before the first layout is printed
	total.qoor = 0
	lines.printed = 0

after.program:
	| runs once after the last layout
	| for example write a log line with lines.printed

Layout sections

header.1:
before.layout:
	| runs before the page header layout is printed

detail.1:
before.layout:
	| suppress this line when the condition holds
	if tdsls401.qoor = 0 then
		lattr.print = false
	endif

after.layout:
	| runs only after the line was printed
	total.qoor = total.qoor + tdsls401.qoor
	lines.printed = lines.printed + 1

Edit the script in Reports (ttadv3530m000); it compiles with the report. Layout names such as header.1 and detail.1 must match the layouts defined in your report. To print the running total variable on a footer layout, add it as a report field; check in the Report Script Features part of the Infor ES Programmer's Guide how your Tools version exposes script variables and which predefined lattr variables it supports.

Rationalise your LN custom reports

Send us your list of custom reports and scripts, and we will flag which can move to Report Designer and which still need scripts.

Optional. The tool and every export work without this. No spam.

Was this tool useful?

How to use it

Enter the report code, the main table the report prints, the quantity field you want totalled and the condition under which a detail line should not print. Open the report in Reports (ttadv3530m000) in your own VRC, open its script, paste the blocks and compile the report: the script compiles with it. The layout section names in the script must match the layouts of the report, so check whether your report uses detail.1 or a higher number and whether it has a header layout. Remove sections you do not use.

Report script structure

Infor describes report scripts as event sections written like 4GL program scripts, with their own sections and some special functions. Program sections such as declaration, before.program and after.program run once. Report sections correspond to layouts, such as header and detail, and each can run code before the layout and after it. Text field sections handle text fields. Report scripts let you run extra queries, calculate and aggregate complex print expressions, update database rows, add fields from tables the program script does not read, and change predefined variables such as whether a layout prints.

  • before.layout: set values or suppress the layout
  • after.layout: totals and counters that must only include printed lines
  • lattr.print = false: the layout is not printed this time

Worked example

With the defaults the script skips sales order lines with an ordered quantity of zero. In detail.1 before.layout it sets lattr.print to false for those lines, so after.layout does not run for them and the running total of tdsls401.qoor counts only lines that appear on paper. Because the total is accumulated after printing, it always matches the printed lines, which is the usual cause of totals that disagree with the visible detail when people accumulate in before.layout instead.

Report scripts or Report Designer

Report scripts change behaviour at the source and travel with the report in your VRC, so they suit logic every user of that report needs. For layout changes, personal variants and modern output, LN 10.x offers Report Designer, with its own development guide. If all you need is a different look or an extra field already in the data, use Report Designer and avoid a script. If you need suppression rules, extra queries or calculated totals, a report script is still the direct tool.

Frequently Asked Questions

How do I suppress a line in an Infor LN report?

In the report script, in the before.layout section of that layout, set lattr.print to false when your condition holds. The layout is not printed for that record and its after.layout section does not run. Confirm the predefined variable list for your Tools version in the Programmer's Guide.

Where do I edit an LN report script?

In Reports (ttadv3530m000). Select the report in your customer VRC, open the script and edit it. The script is compiled automatically when you compile the report, so there is no separate compile step in Program Scripts / Libraries.

Is there an Infor LN Report Designer development guide?

Yes, Infor publishes a Report Designer development guide for LN 10.x on docs.infor.com. It covers designing and personalising report layouts. Report scripts are covered separately in the Report Script Features part of the Infor ES Programmer's Guide.

Why does my report total not match the printed lines?

Usually because the total is accumulated in before.layout, which runs even for lines that are then suppressed, or because the condition is evaluated in a different layout. Accumulate in after.layout of the detail layout so only printed lines count.

If your users mostly want answers that today need a custom report, we can let them ask LN in plain English on your own servers, with the query shown.

ArchRay builder
Design the on-prem AI stack for Infor LN and Baan: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Guides

Integrations

Software