External database

Hi
Thanks for always corresponding to my queries. It is so much appreciated.

I have another chalenge.

I have an application of which part of it prints labels. The app is written in Clarion 8 and I am using the Clarion templates (TPS) files. On the label there is ony the Church’s name and a reference number. The chalenge I have is to insert the 12 months of the year on each label, having 12 labels per reference number with the monthname. Please guide me how exactly to do this. The main DCT file is Logos.dct. The reference number is Log:pledge. Kind regards

I’ll give you the simplest way, though it is by no means the most efficient.

You set up a TPS file that has whatever info you need from your main file (log:pledge), plus a column to hold a month name.

You run a process that loops through your log file and in the TakeRecord embed point you have something like:

loop i# = 1 to 12
   pl:pledge = log:pledge
   pl:month = mn[i#]
   add(printlabels)
end ! loop

where mn is a dimensioned variable you have set up with the names of each of the twelve months.

So now you have a file that has twelve rows for each row in your original file, with the twelve months in the “month” variable.

You can then use that table as the source for your labels, and you can probably delete it after you have done.

So you have a label already set up to print and you need to print 12 copies of it with the corresponding month name on the label?

Add a MonthName variable to your data. Place the MonthName variable wherever you want it on your label. I assume your label is defined within a Detail band, let me call it ?LabelDetail - make sure the detail has LabelDetail as the Label and ?LabelDetail as the Use variable in your report designer.

Now go to the report Actions/ReportProperties and find the Filters tab.
Change the Filter for ?LabelDetail to False. (Just write False in there)

Save the procedure.

Now open the procedure to look at the source (Right click on the procedure name and choose Source)

Search for ReturnValue = PARENT.TakeRecord()

In the embed after this line add the following code…

LOOP Counter = 1 TO 12      ! Define a local variable called Counter, a LONG
  MonthName = CHOOSE(Counter,'January','February', etc, etc)
  PRINT(?ReportDetail)
END

…that should do it? Run the report and see what happens.

(Edit: Clarified some of the instructions)

1 Like