Subject Re: ApplyLocate error
From Ruth Bromer <ruth@treklite.com>
Date Wed, 17 Jul 2019 15:37:47 -0400
Newsgroups dbase.getting-started
Attachment(s) screener3Up.repT-Shirts To Be Ordered.pdf

I couldn't get that to work as I'd like so I still am using the previous
code.  If I have time, I'll look further into this.

However--- I got my report done!!!  I changed it to 3 up rather than 2
up to get it onto one page.  I just need to check that the order is correct.

(You'll see a lot of colors ordered for women's small.  Not all are
available, so I'm passing all my choices to the screener and then he'll
let me know which I can't get.  I'm not quite as crazy as it looks.)

Ruth

On 7/17/2019 3:28 AM, Mervyn Bick wrote:
> On 2019-07-17 2:23 AM, Ruth Bromer wrote:
>> I have a program to create a table to be used to create a report for
>> the shirt screener. (Mervyn wrote the original program with some
>> modifications from me.)
>>
>> Since I have to add a few shirt orders that aren't coming from my
>> input csv file, I am adding them to the input file and then resorting
>> the output table (TShirtSorted.dbf).
>>
>> The original Screener.prg uses the table, Packet.dbf as input.  I want
>> to use the TShirtSorted.dbf as input.  They both have the same
>> relevant fields, shirt size and shirt color.  Most of the code is the
>> same.
>
>
> There is a far simpler way of getting the totals.  I can kick myself for
> not doing this in the first place.
>
>
> In packet.dbf the fields were tshirtsize,tshirtcolor and tshirtquant.
>
> Instead of messing around building a new table I should have used the
> following,
>
>
> sql = "select tshirtsize,tshirtcolor,cast(sum(tshirtquant) as int) as
> tshirtquant from packet where tshirtquant > 0 group by
> tshirtsize,tshirtcolor order by tshirtsize"
>
> Because I built a new table with the fields t_size,t_color and qty as
> the fields these fieldnames are used in screener.rep
>
>
> Replace the SQL in screener.rep with the following.  This will convert
> the fieldnames in packet (or tshirtorders) table to the fields used in
> the report.  Just change packet to whatever table you use.
>
> sql = "select tshirtsize t_size, tshirtcolor t_color,
> cast(sum(tshirtquant) as int) as qty from packet where tshirtquant >0
> group by tshirtsize, tshirtcolor order by tshirtsize"
>
> Mervyn.




** END HEADER -- do not remove this line
//
// Generated on 07/17/2019
//
local r
r = new SCREENERREPORT()
r.render()

class SCREENERREPORT of REPORT
   set procedure to :DUFLP:Repcntl.cc additive
   with (this)
      metric = 3        // Inches
      autoSort = false
   endwith

   this.T_ORDERS1 = new QUERY(this)
   with (this.T_ORDERS1)
      left = 6.0
      sql = "select t_size, t_size_order, t_color, t_color_order, qty from T_orders order by t_size_order, t_color_order"
      requestLive = false
      active = true
   endwith

   this.STREAMSOURCE1 = new STREAMSOURCE(this)
   this.STREAMSOURCE1.GROUP1 = new GROUP(this.STREAMSOURCE1)
   with (this.STREAMSOURCE1.GROUP1)
      groupBy = "t_size_order"
   endwith

   with (this.STREAMSOURCE1.GROUP1.footerBand)
      onRender = class::FOOTERBAND_ONRENDER
   endwith

   with (this.STREAMSOURCE1.GROUP1.headerBand)
      preRender = class::HEADERBAND_PRERENDER
   endwith

   this.STREAMSOURCE1.GROUP1.headerBand.TEXTT_SIZE1 = new TEXT(this.STREAMSOURCE1.GROUP1.headerBand)
   with (this.STREAMSOURCE1.GROUP1.headerBand.TEXTT_SIZE1)
      height = 0.2083
      left = 0.6
      top = 0.05
      width = 1.5
      variableHeight = true
      prefixEnable = false
      fontSize = 11.0
      fontBold = true
      text = {||this.form.t_orders1.rowset.fields["t_size"].value}
   endwith

   this.STREAMSOURCE1.GROUP1.headerBand.TEXT1 = new TEXT(this.STREAMSOURCE1.GROUP1.headerBand)
   with (this.STREAMSOURCE1.GROUP1.headerBand.TEXT1)
      height = 0.2083
      left = 0.1667
      top = 0.05
      width = 0.3
      prefixEnable = false
      picture = "99"
      fontSize = 11.0
      fontBold = true
      text = {||this.parent.parent.agSum({||this.parent.rowset.fields[ "qty" ].value})}
   endwith

   this.STREAMSOURCE1.GROUP1.headerBand.LINE1 = new LINE(this.STREAMSOURCE1.GROUP1.headerBand)
   with (this.STREAMSOURCE1.GROUP1.headerBand.LINE1)
      left = 0.0417
      right = 2.1979
      top = 0.0208
      bottom = 0.0208
      width = 1
   endwith

   with (this.STREAMSOURCE1.detailBand)
      height = 0.1736
   endwith

   this.STREAMSOURCE1.detailBand.TEXTT_COLOR1 = new TEXT(this.STREAMSOURCE1.detailBand)
   with (this.STREAMSOURCE1.detailBand.TEXTT_COLOR1)
      height = 0.2035
      left = 0.6
      top = 0.0
      width = 0.7
      variableHeight = true
      prefixEnable = false
      text = {||this.form.t_orders1.rowset.fields["t_color"].value}
   endwith

   this.STREAMSOURCE1.detailBand.TEXTQTY1 = new TEXT(this.STREAMSOURCE1.detailBand)
   with (this.STREAMSOURCE1.detailBand.TEXTQTY1)
      height = 0.2035
      left = 1.4
      top = 0.0
      width = 0.3
      variableHeight = true
      prefixEnable = false
      alignHorizontal = 2        // Right
      picture = "999"
      text = {||this.form.t_orders1.rowset.fields["qty"].value}
   endwith

   with (this.printer)
      duplex = 1        // None
      orientation = 2        // Landscape
      paperSource = 15
      paperSize = 1
      resolution = 3        // Medium
      color = 2        // Color
      trueTypeFonts = 1        // Bitmap
   endwith

   this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
   with (this.PAGETEMPLATE1)
      height = 8.5
      width = 11.0
      marginTop = 0.5
      marginLeft = 0.0104
      marginBottom = 0.5
      marginRight = 1.4375
      gridLineWidth = 0
   endwith

   this.PAGETEMPLATE1.STREAMFRAME1 = new STREAMFRAME(this.PAGETEMPLATE1)
   with (this.PAGETEMPLATE1.STREAMFRAME1)
      height = 6.9
      left = 0.25
      top = 0.6
      width = 2.2
      form.STREAMFRAME1 = form.pagetemplate1.streamframe1
   endwith

   this.PAGETEMPLATE1.STREAMFRAME2 = new STREAMFRAME(this.PAGETEMPLATE1)
   with (this.PAGETEMPLATE1.STREAMFRAME2)
      height = 6.9
      left = 3.5
      top = 0.6
      width = 2.2
      form.STREAMFRAME2 = form.pagetemplate1.streamframe2
   endwith

   this.PAGETEMPLATE1.STREAMFRAME3 = new STREAMFRAME(this.PAGETEMPLATE1)
   with (this.PAGETEMPLATE1.STREAMFRAME3)
      height = 6.9
      left = 6.75
      top = 0.6
      width = 2.2
      form.STREAMFRAME3 = form.pagetemplate1.streamframe3
   endwith

   this.PAGETEMPLATE1.TEXT1 = new TEXT(this.PAGETEMPLATE1)
   with (this.PAGETEMPLATE1.TEXT1)
      height = 0.3438
      left = 3.4583
      top = 0.0
      width = 2.7292
      prefixEnable = false
      fontSize = 17.0
      fontBold = true
      text = "T-Shirts To Be Ordered"
      form.TEXT1 = form.pagetemplate1.text1
   endwith

   this.PAGETEMPLATE1.EVENTDATE = new TEXT(this.PAGETEMPLATE1)
   with (this.PAGETEMPLATE1.EVENTDATE)
      height = 0.3021
      left = 0.625
      top = 0.0626
      width = 1.6458
      prefixEnable = false
      fontSize = 14.0
      fontBold = true
      text = "August 1-4, 2019"
      form.EVENTDATE = form.pagetemplate1.eventdate
   endwith

   this.PAGETEMPLATE1.KMDATETEXT1 = new KMDATETEXT(this.PAGETEMPLATE1)
   with (this.PAGETEMPLATE1.KMDATETEXT1)
      height = 0.2083
      left = 6.9584
      top = 0.0542
      width = 2.0625
      fontSize = 12.0
      fontBold = true
      form.KMDATETEXT1 = form.pagetemplate1.kmdatetext1
   endwith

   with (this.reportGroup.footerBand)
      expandable = false
      height = 0.27
   endwith

   this.reportGroup.footerBand.TEXT1 = new TEXT(this.reportGroup.footerBand)
   with (this.reportGroup.footerBand.TEXT1)
      height = 0.2083
      left = 0.0521
      top = 0.06
      width = 1.4375
      prefixEnable = false
      fontSize = 11.0
      fontBold = true
      text = "T-Shirts Ordered:"
   endwith

   this.reportGroup.footerBand.TEXT4 = new TEXT(this.reportGroup.footerBand)
   with (this.reportGroup.footerBand.TEXT4)
      height = 0.2083
      left = 1.573
      top = 0.06
      width = 0.4625
      variableHeight = true
      prefixEnable = false
      alignHorizontal = 2        // Right
      picture = "999"
      fontSize = 11.0
      fontBold = true
      text = {||this.parent.parent.agSum({||this.parent.STREAMSOURCE1.rowset.fields["qty"].value})}
   endwith

   this.reportGroup.footerBand.LINE1 = new LINE(this.reportGroup.footerBand)
   with (this.reportGroup.footerBand.LINE1)
      left = 0.0104
      right = 2.1979
      top = 0.0208
      bottom = 0.0208
      width = 2
   endwith

   with (this.reportGroup.headerBand)
      height = 0.0
   endwith

   this.firstPageTemplate = this.form.pagetemplate1
   this.form.pagetemplate1.nextPageTemplate = this.form.pagetemplate1
   this.form.pagetemplate1.streamframe1.streamSource = this.form.streamsource1
   this.form.pagetemplate1.streamframe2.streamSource = this.form.streamsource1
   this.form.pagetemplate1.streamframe3.streamSource = this.form.streamsource1
   this.form.streamsource1.rowset = this.form.t_orders1.rowset

   function FOOTERBAND_onRender()
      nSpaceRemaining = this.streamFrame.height - this.renderOffSet
         nSpaceNeeded = 1.4
         if nSpaceRemaining < nSpaceNeeded
              this.parent.headerband.height = 2
          else
               this.parent.headerband.height = .25          
         endif
      return

   function HEADERBAND_preRender()
      this.height = .25
      return

endclass