Print from History using math

Discuss your general Proclaim related queries here.
lzhu19
Posts: 2
Joined: Mon Jun 10, 2019 6:39 pm

Print from History using math

Hi all,

I am quite new to Proclaim and there is a function I want to build but I can't seem to find related documents on doing this.
I have pulled a selected list of History File into a table and I need to print them in order.

Also, it doesn't seems like I can get access to the file just by using print with the document_code I get from file:

I tried to get the file by:
v = FETCH( "CONTENT" , "History" , "document_code" , "FOR FIRST History NO-LOCK WHERE History.case_no = '" + {case.key} + "' AND (document_code = '" v-result "' )" )

that will only return me the code, which I already have. How would I get the document itself?

HERE is what I have so far with some pseudo code
v-entries = TABLECOUNT( {TEST-FILES-FROM-FOLDER.Table} )
TABLEFIRST( {TEST-FILES-FROM-FOLDER.Table} )
v-result = {TEST-FFF-FileNo.Text}
v = FETCH( "CONTENT" , "History" , "document_code" , "FOR FIRST History NO-LOCK WHERE History.case_no = '" + {case.key} + "' AND (document_code = '" v-result "' )" )
#PRINT( v )
### go to history and find the entry that matches with the file number
### add them to a list if list is even a thing
#WHILE v-entries > 0 DO
# TABLENEXT( {TEST-FILES-FROM-FOLDER.Table} )
# v-result = {TEST-FFF-FileNo.Text}
# v-entries = v-entries -1
# print the file selected
#END

steve
Posts: 388
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 80 times

Re: Print from History using math

Hi,
can you clarify your requirements a little - as I understand it:

you've created a proclaim Table containing a list of a handful of history rows - specifically your table contains the document_code of the history documents/files (word/pdf etc)that you want to print? - eg something like

Date // Description // Document_code
01/01/2019 // test doc 1 // 12345678
02/02/2019 // test doc 2 // 12345679

is this correct?

Then you want to be able to print out each document in that table, by e.g. pressing a button on a screen?

v = FETCH( "CONTENT" , "History" , "document_code" , "FOR FIRST History NO-LOCK WHERE History.case_no = '" + {case.key} + "' AND (document_code = '" v-result "' )" )
will just return the very same document code (e.g. 12345678) that you have defined in the variable v-result. Your new variable "v" will just contain the number "12345678". If nothing else, this line of code will sanity check that the document code in 'v-result' is valid.

Likewise the "PRINT" command in Proclaim Maths is very primitive and probably won't do what you think/hope it does (namely print a file/document!)

Let us know if my interpretation of your requirements is on the right track, then we'll hopefully be able to point you in the right direction.

lzhu19
Posts: 2
Joined: Mon Jun 10, 2019 6:39 pm

Re: Print from History using math

Hi Steve,

You are correct in your interpretation. I need to print off all the files in the table in the order it is set, based on the folder they are in (this is already done).
The execution would be carried out through a button, which iterate through each row in table and print the corresponding file.

Initially I was trying to create a PDF bundle of the items in the table, but I could not find a good way to push an array into the MEMO for creating a PDF Bundle. Do you have any insight in doing this?

Thanks,

steve
Posts: 388
Joined: Wed Nov 30, 2011 10:20 pm
Been thanked: 80 times

Re: Print from History using math

Hi,
can you try something out for me, and see if this is a valid approach for you:
make a test Word or PDF file, and store it somewhere on your computer like c:\temp\test.doc
make a linked action with the following maths:

Code: Select all

COPY-FILE ("c:\temp\test.doc", "\\path\\to\\your\\network\\printer")
(obviously replacing the second argument with your actual printer path\name)

if it works, and is a suitable direct print method for you, then we can elaborate on how to extend it to print to any file in a table

failing that, your last resort might be making, e.g. 30 embedded doc holding fields, attach these to a memo bundle, then looping through your table and PUTting each history document's code into its own holding field, then producing the bundle.