Quartam Reports Help

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
kathir
Posts: 11
Joined: Fri Feb 16, 2007 7:55 am
Contact:

Quartam Reports Help

Post by kathir » Fri Apr 13, 2007 3:52 pm

hi all

anybody interested

i am using Quartam Report 1.0.5 for my project reports.. i have a prob here,
the report sample..looks like
i have one header record and one footer record..
and also have the details was going to put between the header and footer..
the details like " Reg.No Description qty Total " ok
i have a list of values to show in the report, the prob is in the Description field i have different hight, i mean for first record may be 2 lines, and second record may be 5 lines and third record may be 1 line...
if my records are like this, i could not see all records fully, if i increase the hight of the field of Description in the Quartam report, its not changing
for the next record... keeps space...
and also i need that it has to go to next page for the remaining records...

can u help me,,

the reports sample look like this


Reg No Description Qty Total[/color]

ABC123 first Line 5 100000.00
Second Line
Third Line
DEF456 First Line 2 14500.00
Second Line
GHI First Line 8 64541.55
Second Line
Third Line
Fourth Line
Fifth Line
JKL First Line 4 65444.22



something like this,,,, is it possible in this version of Quartam Report...

thanks to u in advance....
bye
Kathir

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Sat Apr 14, 2007 6:39 pm

Hi Kathir,

While it's possible to do this with Quartam Reports 1.0.5, it's a not-so-obvious workaround requiring the Professional Edition. In a nutshell, you have to script a data broker that will feed the detail data one line at a time, flagging the type of data that is displayed (a complete line or just a text line) - and then you'll have to apply printing conditions to the detail band items that only need to be displayed on the first line of the block.

Here's some sample code for a data broker script:

Code: Select all

local sDetailData, sDetailLongText, sDetailPartNumber
local sRecordCount, sCurrentRecord, sRecordsData

on mouseUp
  -- prepare the mockup data here
  MyPrepReport
  -- now print the report
  qrtReports_printReport \
      "MyLayout.qrl", \     -- provide complete path to layout file
      the long ID of me, \  -- use this control as the data broker
      true                  -- display preview on screen
end mouseUp

-- NOTE :: data preparation handlers

on MyPrepReport
  -- initialize the local variables
  put 3 into sRecordCount
  put 0 into sCurrentRecord
  put 1 into sDetailPartNumber
  -- setup the first record
  put "ABC123" into sRecordsData[1,"code"]
  put "First line" & return & \
      "Second line" & return & \
      "Third line" into sRecordsData[1,"description"]
  put 5 into sRecordsData[1,"units"]
  put 100000.00 into sRecordsData[1,"total"]
  -- setup the second record
  put "DEF456" into sRecordsData[2,"code"]
  put "First line" & return & \
      "Second line" into sRecordsData[2,"description"]
  put 2 into sRecordsData[2,"units"]
  put 14500.00 into sRecordsData[2,"total"]
  -- setup the third record
  put "GHI" into sRecordsData[3,"code"]
  put "First line" & return & \
      "Second line" & return & \
      "Third line" & return & \
      "Fourth line" & return & \
      "Fifth line" into sRecordsData[3,"description"]
  put 8 into sRecordsData[3,"units"]
  put 64541.55 into sRecordsData[3,"total"]
end MyPrepReport

on MyPrepNextDetail
  if sDetailPartNumber > the number of lines in sDetailLongText then
    -- we've printed all the lines, so read in the next record
    add 1 to sCurrentRecord
    put sRecordsData[sCurrentRecord,"description"] into sDetailLongText
    put 1 into sDetailPartNumber
    put sRecordsData[sCurrentRecord,"code"] into sDetailData["code"]
    put sRecordsData[sCurrentRecord,"units"] into sDetailData["units"]
    put sRecordsData[sCurrentRecord,"total"] into sDetailData["total"]
  end if
  -- extract the right chunk from the long text
  put line sDetailPartNumber of sDetailLongText into sDetailData["description"]
end MyPrepNextDetail

-- NOTE :: qrtReportsLib callbacks

on qrtReports_moveNextRecord
  -- update our sDetailPartNumber local variable
  add 1 to sDetailPartNumber
  -- and fill up the detail data
  MyPrepNextDetail
end qrtReports_moveNextRecord

function qrtReports_endOfReport
  -- we've reached the end if we've passed our last record
  return (sCurrentRecord > sRecordCount)
end qrtReports_endOfReport

function qrtReports_valueOfExpression pExpression
  -- this function will evaluate an expression and return the result
  put pExpression into tExpression
  replace "<QUOTE_REPLACEMENT>" with quote in tExpression
  return value(tExpression)
end qrtReports_valueOfExpression
Armed with this data broker, you can then construct the report layout, putting 4 data fields into the detail band:
1. For the first column:
- expression = sDetailData["code"]
- condition = sDetailPartNumber is 1
2. For the second column:
- expression = sDetailData["description"]
- no condition
3. For the third column:
- expression = sDetailData["units"]
- condition = sDetailPartNumber is 1
4. For the fourth column:
- expression = sDetailData["total"]
- condition = sDetailPartNumber is 1

When you click the button to preview the report, you'll see that it generates all the detail lines, splitting up the multi-line description, and only printing the other columns on the first line of the block.

You'll be glad to hear that the upcoming Quartam Reports version 1.1 has dynamically stretching data fields, effectively ending the need for the sort of workaround described above.

Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

kathir
Posts: 11
Joined: Fri Feb 16, 2007 7:55 am
Contact:

Post by kathir » Tue Apr 17, 2007 2:23 pm

Thanks Mr.Jan Schenkel

The code is works fine,,, thank u very much

by
Kathir

Post Reply