Page 1 of 1

Printing need Help

Posted: Mon Feb 24, 2014 10:47 am
by blairetabay
Good day!


Im new in livecode.

i have a serious problem regarding with printing im using a quartam report builder.

i have a database and inside my database i have a table and all the value i have in my table i populate in a datagrid. all i need is to print all the value inside my datagrid.

i search for some of the sample but it does not work.

datagrid name is dgGrid
quartam field expression is sample["sample1"]
quartam field expression is sample["sample2"]
quartam field expression is sample["sample3"]
quartam field expression is sample["sample4"]

here is my code

Code: Select all


  add 1 to printCount
   
   if (printCount > 0) Then   

  --FETCH the next row from the Data Grid
      put the dgDataOfIndex[printCount] of the group "dgGrid" into tDataRow
      put the dgDataOfIndex  of the group "dgGrid" into tDataRow
     
           
            put tDataRow["Col 3"] into sample["sample1"]
            put tDataRow["Col 3"] into sample["sample2"]
            put tDataRow["Col 3"] into sample["sample3"]
            put tDataRow["Col 4"] into sample["sample4"]
      
            
   end if   
  



Re: Printing need Help

Posted: Mon Feb 24, 2014 5:12 pm
by MaxV
You can print a window with:

Code: Select all

print this card

Re: Printing need Help

Posted: Tue Feb 25, 2014 2:24 am
by blairetabay
hi MaxV

i'm using the demo of quartam is there any another way that I could print? or a hard coding for the printing of LC


blairetabay

Re: Printing need Help

Posted: Tue Feb 25, 2014 3:45 am
by Simon
Hi blairetabay,
Are you speaking of "printing" to screen or hardcopy?
I don't see any print commands in the code you provided.

qrtReports_PrintReportFromStack tLayoutFile, tStackName, tShowPreview
is the code from the example here;
http://users.telenet.be/quartam/reports/examples.html

Simon

Re: Printing need Help

Posted: Tue Feb 25, 2014 4:11 am
by blairetabay
Simon,

I have already that one, I did not include in my code.I only posted is in the datagrid that will get one column and its row because i want to print per column inside my datagrid. from this

Code: Select all

put revdb_columnnames(sCursorID) into tColumnNames

repeat for each item tColumnName in tColumnNames
put revdb_columnbyname(sCursorID,tColumnName) into \
sRecordAsArray[tColumnName]
end repeat
-- retrieve the data from our supplier website
put "sample URL what ever=" & \
URLEncode(sRecordAsArray["article_id"]) into tRemoteURL
put URL tRemoteURL into sRecordAsArray["delivery_days"]
end PrepareRecordData


from the above code i make a datagrid that will read each column and will print per column.

Re: Printing need Help

Posted: Tue Feb 25, 2014 4:26 am
by Simon
Hi blairetabay,
I'm sorry I don't understand what you are asking for.
Maybe someone else will know.

Simon

Re: Printing need Help

Posted: Tue Feb 25, 2014 5:17 am
by blairetabay
Simon,

:cry:

im only asking how to print all the data inside my datagrid.

:idea:

Re: Printing need Help

Posted: Tue Feb 25, 2014 5:24 am
by Simon
OK short answer;
put the data into a field and then "print this card".

But that was said above???

Simon

Re: Printing need Help

Posted: Tue Feb 25, 2014 8:04 am
by blairetabay
Simon,


I know that one the print this card.
all i want is the data inside my datagrid to be printed. not the card itself.

i'm working on the standalone windows app

here is my code

Code: Select all

  PrepareRecordData
   -- get ready to print
   local tLayoutFile, tDataBroker, tShowPreview
   put AbsolutePath ("tabaySample.qrl") into tLayoutFile
   put the long ID of me into tDataBroker
   put true into tShowPreview
   -- print the report
   qrtReports_PrintReport tLayoutFile, tDataBroker, tShowPreview
   -- clean up after printing
   get revdb_closecursor(sCursorID)
   get revdb_disconnect(sConnectionID)
end mouseUp

on PrepareRecordData
   ## PREPARE THE DATA FROM THE CURRENT RECORD FOR PRINTING
   
   -- define the variables
   
   local tColumnNames, tColumnName,tDataRow
   -- copy the contents of the current record into the array
   -- column per column
   put revdb_columnnames(sCursorID) into tColumnNames
   
   repeat for each item tColumnName in tColumnNames
      put revdb_columnbyname(sCursorID,tColumnName) into \
            sRecordAsArray[tColumnName]
   end repeat
   
---- retrieve the data from our supplier website
   --   put "url something here=" & \
         --         URLEncode(sRecordAsArray["article_id"]) into tRemoteURL
   --put URL tRemoteURL into sRecordAsArray["delivery_days"]
   

--quartam empression is sample["sample1"] and so on.......

   put the GetDataOfLine   of the group "dgGrid" into tDataRow
   #put the dgHilitedIndexes    of the group "dgGrid" into tDataRow
      put (tDataRow["recordNum"]) into sample["sample1"]
      put (tDataRow["PatientName"]) into sample["sample2"]
      put (tDataRow["Col 3"] )into sample["sample3"]
      put (tDataRow["Col 4"] )into sample["sample4"]
        
   
   #print this card
      
    
   
end PrepareRecordData



-- Quartam Reports Callback Handlers and Functions

function qrtReports_EndOfReport
## QR :: RETURN TRUE IF THE END OF THE REPORT HAS BEEN REACHED
-- we've reached the end if we've passed our last record
return (sCurrentRecord > sRecordCount)
end qrtReports_EndOfReport

on qrtReports_MoveNextRecord
## QR :: PREPARE EVERYTHING FOR PRINTING THE NEXT RECORD
-- update the sCurrentRecord local variable
add 1 to sCurrentRecord
-- move to the next record in the cursor
get revdb_movenext(sCursorID)
-- and prepare the record data
PrepareRecordData
end qrtReports_MoveNextRecord

function qrtReports_ValueOfExpression pExpression
## QR :: EVALUATE THE EXPRESSION AND RETURN THE RESULT
-- workaround for limitation in LiveCode engine
local tExpression
put pExpression into tExpression
replace "<QUOTE_REPLACEMENT>" with quote in tExpression
return value(tExpression)
end qrtReports_ValueOfExpression

function AbsolutePath pRelativePath
  ## this helper function looks for files from the directory where the stack is saved
  put the effective filename of this stack into tAbsolutePath
  set the itemDelimiter to "/"
  put pRelativePath into item -1 of tAbsolutePath
  return tAbsolutePath
end AbsolutePath


any help is recomended for this.

thank you guys in advance :D
:idea:

Re: Printing need Help

Posted: Tue Feb 25, 2014 12:31 pm
by MaxV
OK, you just need a print into rectangle commands, it's explained in the User Guide pdf in Livecode. You can read it form Help -> User Guide
8.10 Printing a Layout
If you need to print a more complex layout than allowed with the basic print card command or text printing commands (described above), you can use the print card into rect syntax to create any sort of layout you choose:

Code: Select all

 print card from topLeft to rightBottom into pageRect
  • The topLeft is the top left coordinate of the current card to start printing at.
  • The rightBottom is the bottom right coordinate of the current card to stop printing at.
  • The pageRect is the rectangular area on the paper to print into.
So, now you know how to print just a part of a card. Otherwise, if your datagrid were huge, you could create a temporary stack; where every card is a part of the datagrid and then launch

Code: Select all

print this stack
This way you can print very big tables, but you can split table over many pages.

Printing DATAGRID need Help

Posted: Tue Feb 25, 2014 5:40 pm
by blairetabay
I'm a beginner in LC i have a serious problem regarding with printing

i try using a print this card the problem with print this card is only the value inside the card. How about i have a datagrid and the data is more than one page of printing.

im developing a standalone app.

i found this code from the example an i dont know how to use it

Code: Select all

on PrepareRecordData
   ## PREPARE THE DATA FROM THE CURRENT RECORD FOR PRINTING
   
   -- define the variables
   
   local tColumnNames, tColumnName,tDataRow
   -- copy the contents of the current record into the array
   -- column per column
   put revdb_columnnames(sCursorID) into tColumnNames
   
   repeat for each item tColumnName in tColumnNames
      put revdb_columnbyname(sCursorID,tColumnName) into \
            sRecordAsArray[tColumnName]
   end repeat

 
--- retrieve the data from our supplier website
      put "http:url something here=" & \
            URLEncode(sRecordAsArray["article_id"]) into tRemoteURL
   put URL tRemoteURL into sRecordAsArray["delivery_days"]
   
here is my code for the datagrid to able to print please help me on this

recordNum is datagrid row name
sample["sample1"] is a quartam expression

Code: Select all


 put the getDataOfIndex of the group "dgGrid" into tDataRow
   put tDataRow, "recordNum" into sample["sample1"]

thank you guys


blaireTabay

Re: Printing DATAGRID need Help

Posted: Tue Feb 25, 2014 5:50 pm
by Klaus
I am afraid, very few folks here will use QuartamReports, so this is a very special problem
that maybe you should ask for in the Quartam forum?
http://forums.quartam.on-rev.com

Re: Printing DATAGRID need Help

Posted: Tue Feb 25, 2014 6:30 pm
by Klaus
OK, I found a way to "Merge" your threads, I think this is a good solution :D

Re: Printing DATAGRID need Help

Posted: Wed Feb 26, 2014 3:41 pm
by blairetabay
Klaus,


the link that you given is not available for quartam forum.

many thanks anyway.

best

blaireTabay

Re: Printing DATAGRID need Help

Posted: Wed Feb 26, 2014 4:04 pm
by Klaus
Hi Blaire,

the link is working for me!? :shock:


Best

Klaus