Adding Premiere previewer to hand coded report

I have a couple of hand coded reports printing from memory queues. I used to use TinTools previewer in C6 and now migrating to C11 and starting to use Premiere. I added global extension, but when compiling I get “Unknown function label - No matching prototype available” errors

Must be missing something,

my code below :

`ReportTitle = ’ Printed ’ & FORMAT(CLOCK(),@T7)
OPEN(Report)
report{Prop:Preview} = PrintPreviewQueue.PrintPreviewImage
RecNo#=1
LOOP RECORDS(MyQeue) TIMES
GET(MyQeue,RecNo#)
IF ERRORCODE() THEN BREAK.
PRINT(RPT:Detail)
RecNo#+=1
END
ENDPAGE(report)

Clear(PreviewParms)
PreviewParms.Report &= Report
PreviewParms.ReportName = ReportTitle
PreviewParms.PDFFileName = CLIP(ReportTitle) & ‘.pdf’
PreviewParms.ExcelFileName =CLIP(ReportTitle) & ‘.xlsx’
PreviewParms.WordFileName = CLIP(ReportTitle) & ‘.docx’
PreviewParms.PreventFilenameChange = 0
PreviewParms.HideWindow = Choose(true,false,true) ! set from global default
PreviewParms.OpenDocument = false ! set from global default
ReturnValue = Premiere(PrintPreviewQueue,Report,PreviewParms)
CLOSE(report)`

Whole test application here https://yait.blog/clarion/PremiereTest.zip

No matching prototype available

this means the procedure name you called, with the parameters you used, does not match a procedure(parameters) that is “in scope”.

Your Premiere procedure is “declared globally” - so that’s always in scope, so we can eliminate scope as the cause. Which means we look closely at the parameter list.

the prototype is
(PrintPreviewFileQueue pWmfQueue,,)

Your call is
Premiere(PrintPreviewQueue,Report,PreviewParms)

your PrintPreviewQueue is declared as
PrintPreviewQueue QUEUE,PRE
PrintPreviewImage STRING(80)
END

However this is not a PrintPreviewFileQueue. (yes, it’s functionally the same, but it’s not specifically a PrintPreviewFileQueue, which is what the compiler is insisting on.)

you should rather declare it as
PrintPreviewQueue QUEUE(PrintPreviewFileQueue),PRE
END

That contains 2 fields;
Filename STRING(FILE:MaxFileName)
PrintPreviewImage STRING(FILE:MaxFileName),OVER(Filename)

So your current use of PrintPreviewImage is fine. (Incidentally your String(80) is a bit short, but that’s irrelevant now.)

1 Like

Thanks Bruce

I used that queue with TinTool previewer, that report was created about 15 years ago so I do not remember why I only used STRING(80) but it was working. I did not realize that it needs specific name of the queue

Now I declared these local data
PreviewParms group(PremierePreviewerOptions)
END
PrintPreviewQueue QUEUE(PrintPreviewFileQueue),PRE
END

and my printing code

OPEN(Report)
report{Prop:Preview} = PrintPreviewQueue
RecNo#=1
LOOP RECORDS(MyQueue) TIMES
    GET(MyQueue,RecNo#)
    IF ERRORCODE() THEN BREAK.
    PRINT(RPT:Detail)
    RecNo#+=1
END
ENDPAGE(report)

Clear(PreviewParms)
PreviewParms.Report &= Report
PreviewParms.ReportName = ReportTitle
PreviewParms.PDFFileName = CLIP(ReportTitle) & '.pdf'
PreviewParms.ExcelFileName = CLIP(ReportTitle) & '.xlsx'
PreviewParms.WordFileName = CLIP(ReportTitle) & '.docx'
PreviewParms.PreventFilenameChange = 0
PreviewParms.HideWindow = Choose(true,false,true) ! set from global default
PreviewParms.OpenDocument = True   ! set from global default

ReturnValue = Premiere(PrintPreviewQueue,Report,PreviewParms)
PremiereDeleteFilesInPrintPreviewQueue(PrintPreviewQueue)
CLOSE(report)
FREE(PrintPreviewQueue)

and it works fine, even with regional language characters on pdf export

I uploaded the updated example to https://yait.blog/clarion/PremiereTest.zip . It prints from memory using hand-coded report, standard Clarion report from file and form queue. Might be useful to someone as a simple example for hand coders.

On a separate note, I’m calling Premiere as function, but not really checking return values. Does it make sense to check these and what does it return?

Greg

Thanks for the example. I’ll add a procedure similar to this in the ABC example.

At the moment it always returns 0 (unless changed by embed code in the Premiere procedure.) It’s partly there for future use.