The following article originally appeared on the IndySoft Corporation Blog October 11, 2016.


Today we are going to give you a super-fast way to add overall As Found and As Left conditions to your certificates. Sometimes when a customer receives a certificate of calibration they want a simple indicator of the as found and as left conditions instead of manually reviewing each individual test point. If you are not delving into percent of tolerance pass/fail scenarios and just want those immediate fail/pass, fail/fail, pass/pass conditions, this post is for you. This tutorial assumes you have moderate experience with Printbuilder and modifying certificate of calibration templates.

The Five Verdict Types

As of this writing, IndySoft supports five primary verdict types: Pass, Fail, Adjusted, Limited Use, and Report of Value. For this post we are only concerned with the Pass, Fail, and Adjusted verdicts. Limited Use can be used to craft Pass/Fail criteria but it involves getting a little more involved with analyzing each individual test point and is beyond the scope of this tutorial. Within the event model the EVENT_RESULT (Referred to as ‘Event Result’ in PrintBuilder) field contains the following three to four character values: PASS, FAIL, ADJ., LTD., and ROV. Placed into a Matrix the three verdicts we are concerned with map to As Found/As Left conditions as follows:

EVENT_RESULT
As Found
As Left
PASS
Pass
Pass
FAIL
Fail
Fail
ADJ.
Fail
Pass

So when we read the EVENT_RESULT we have all we need to know about the As Found and As Left verdicts. So now let’s put that data to use on a certificate of calibration.

Modifying the Certificate

Select an asset in IndySoft and right mouse click a calibration event in the history tab containing data you wish to use when testing your certificate layout. Select the “Use this event when designing in Printbuilder” option.


Selecting Use Event When Designing In Printbuilder

Tip: Use when designing functionality will allow you to review your design in Printbuilder using real data.

Launch Printbuilder. For the tutorial we are going to work on a copy of a certificate but you can apply these changes to your production certificate of calibration if desired.

Select the Certificates group followed by clicking the New icon. Enter a template name of PASSFAILCERT and select to clone your standard template. Now double-click the template to launch into the template editor.


Creating The New Certificate Template


Select the EVENTS pipeline tab at the footer of the page to reveal the header information for the certificate.


Select The Events Pipeline At The Bottom of The Page

Find a suitable place for the As Found and As Left data then drop four label fields in the area, positioning them as desired. Select the first label and change the caption to “As Found:” followed by selecting the third label and changing the caption to “As Left:.”


Set The Captions of the As Found and As Left Labels


Now select the second label and in the Report Tree hold down then release your mouse button on the Label to invoke the naming editor. Enter the name of “lblAsFound.” Select the fourth label and do the same process naming this label to “lblAsLeft.”


Rename the Verdict Display Labels

Tip: Renaming your objects in PrintBuilder is an often overlooked step in template design. Naming your components makes it much easier to understand which label performs a function when you add any custom scripting to the template. It also allows other administrators to easily understand your certificate design.


With the Events tab still selected, click the Calc tab from the top of the screen.


Select The Calc Tab


From the report objects view/tree select the Detail node then select the Before Print event in the right panel.


Select The Detail Before Print Event


Now click in the lower left half of the window to create the procedure for the event detail before print event.


Invoking the Code Block in the Lower Left


There are various ways to enter code into this window. You will likely just want to copy and paste the code from this tutorial but let’s learn a few things before we get to the code.

The Code Window

The lower half of the calc tab is dedicated to a coding window and the code toolbox containing prototypes for field data, objects, and language. Selecting Data, Objects, or the Language tabs will show additional items in the code toolbox you can select. Selection in that window will load the prototypes you simply drag and drop into the code window to quickly start coding.


The Code Toolbox and Window Supports Drag and Drop


As an example, to add an if… then… else block we could type the information or simply select the Language tab, Statement from the Code Toolbox, then drag and drop the if..then..else prototype to the code window to start our efforts. All data fields in the pipelines and even objects on your templates can be accessed and dragged into the code window in this same manner. So if you are ever unsure exactly how something should be entered, the code toolbox prototypes can be a handy reference or jump start to your efforts.

Ok… lesson over… You can now cheat. Here is the code you are likely just wanting to copy and paste into the code window between the auto-generated begin and end lines:

if (Events['Event Result'] = 'PASS') then
begin
  lblAsFound.Caption := 'Pass';
  lblAsLeft.Caption := 'Pass';
end
else if (Events['Event Result'] = 'FAIL') then
begin
  lblAsFound.Caption := 'Fail';
  lblAsLeft.Caption := 'Fail';
end
else if (Events['Event Result'] = 'ADJ.') then
begin
  lblAsFound.Caption := 'Fail';
  lblAsLeft.Caption := 'Pass';
end
else
begin
  lblAsFound.Caption := '';
  lblAsLeft.Caption := '';
end;


Now that you have the code in place right mouse click the BeforePrint event and select compile.


Compiling the Code to Rule Out Errors

If it turns green you are set. If it turns red, refer to the message window just below the code window for additional help. As long as you named those label fields properly and entered the code between the provided begin and end statements in the code window you should have no issues.


Finally select the preview tab to reveal your results. As you can see, the As Found and As Left fields will populate based on the final verdict of the selected event.


The Preview of the Results

Save your work and close out of printbuilder. Your certificate is now ready for use! We hope this post was beneficial and as always remember you aren’t alone. IndySoft offers a wide range of training, consultation, and turnkey services to help configure your system and reports to meet your critical business needs. Simply contact your IndySoft sales representative for more information.