Replang

Printing 101

**Never say Never!  And I am saying – Never, never, NEVER alter an original file.  Whatever report you want to make changes to, always make a copy of the report file before making changes.  And always, always, ALWAYS work in the copy.  This cannot be emphasized enough.  Although Advent does not restrict clients from making their own changes or building their own reports, they WILL NOT support or correct your mistakes!  And let’s be fair about this – that is reasonable.**

A little background

Replang (short for Reporting Language) is Advent’s proprietary coding language developed specifically for the use with their programs.  They initially utilized labels as a type of basis for the development of the software and language.  Majority of the information that can be pulled into, used and displayed by a report is linked to a label.  Throughout the years as Advent has created, developed and expanded their programs they have also continued to build on this base foundation of the coding and the coding itself has developed and continues to expand with each new platform version released.  But one thing has remained constant – if it isn’t static information and there isn’t an associated label, it isn’t getting on the report.

Basic Printing – Limitations

To start, let’s look at the printing limitations with Replang.  In coding, we print the same way we read – top to bottom, left to right.  When we print in Replang, we start at the top of the page and print each line left to right and then move down to the next line.  One of the few times I tell a client “I can’t do that” is when asked to position something in a specific spot (i.e. so many inches from the bottom or from the side).  Since I am limited with how I can print, this type of request isn’t feasible.  Yes, yes, I could do it, but even if I spent the time to code row counts to try to print in the same spot every time, if someone changes a setting (such as a margin setting or a font size) the coding would have to be adjusted.  Every single time.  Overall, it isn’t worth the time and headache for the amount of work that would be required, the continuous maintenance on the report and even if done, could not be guaranteed to be accurate every run time.

The other limitation to be aware of is that a line has to print with the same format across the entire page.  It is not possible to print part of a line italicized and another part bold.  Either the whole line is bold or none at all.  This also applies with font effects like grey shading.

There are a few other printing limitation and quirks that I am not going to cover right now, but those are the biggest two.  Since this is printing 101 and we don’t need to overload our brains with too much information.  As the old saying goes – keep it simple, stupid.

On to Printing!

There are two things you need to print a line.  You need to indicate to the report that you are starting to print and you need to indicate to the report that you are done printing.  To tell the report to start printing, a period is used and is the only way to start printing regardless of where we are printing or to what we are printing.  To stop printing or end the line, we use “\n”.  There are other end line indicators, all of which will contain the “\” followed by something else, but the “\n” is the most common and the only one we are going to reference for this introduction – because we are keeping it simple!

Here is basic coding of printing a header with the company name, title and report run date:

head

.$^firm\n

$title MY SPECIAL REPORT

.$^title\n

.%2^cutdate\n

.\n

head

The head/head commands are telling the report that anything appearing between the two is part of the header.  Whenever a new page starts, the report knows to repeat this information without the coder having to repeat it.

$firm is the label in your system to identify your company name.  The first line ( .$^firm\n ) is printing the company name.  The period indicates to start printing and anything that follows is then printed to screen.  The “\n” tells the report that we are finished with that line and we can move on to the next line. The caret is an operator that tells the report to print the label centered to the page.  .$firm\n would print left justified, .$^firm\n is centered and .$~firm\n is right justified.

In the next line we are defining the label $title to be MY SPECIAL REPORT.  The next line, similar to the $firm line, is printing the title of the report.  The %cutdate is the run date of the report.  The %cutdate label would have been defined/set earlier when we entered information in the dialog box.  The caret is telling it to print center, but what about the 2?

Numbers are used after a label indicator ($,# or %) as a formatting tool.  If we use a number with a numeric label (i.e. #2initval), we are indicating how many decimal places to print.  If we use it with a string label ($20name), we are telling it how many characters to print before wrapping to the next line.   With dates (%2cutdate), we are providing the date format to print.  In this case 2 = Month Day, Year format.  If we wanted a mm-dd-yyyy format, we would use %4cutdate.

The last printing line ( .\n ) is simply printing a blank line or a space between rows.

With the coding above, if I ran the report for 12/31/2017, the output would be:

MD Solutions

MY SPECIAL REPORT

December 31, 2017

If you want to change the title of the report to MY SUPER DUPER SIMPLE REPORT, it really is as simple (keeping it simple!) as changing the ‘$title MY SPECIAL REPORT’ line of coding to ‘$title MY SUPER DUPER SIMPLE REPORT’.