Subject |
Re: Report Day with DateCalendar.cc |
From |
Mervyn Bick <invalid@invalid.invalid> |
Date |
Sat, 21 May 2016 08:25:14 +0200 |
Newsgroups |
dbase.getting-started |
Attachment(s) |
date_day.rep |
On 20/05/2016 22:16, Randy Waldman wrote:
> Hi. Pro 10.3.1 - working with DateCalendar.cc - (in a field?) below the selected date, I would like to show the day of week Good idea, but I don't know how without hacking the control. Can anyone help?
>
> Thanks, Randy
>
The Datecalendar control is only meant to be used on a form. You won't
be able to use it in a report. The function CDOW() does, however make it
easy enough to display the day below a date in a report.
Place a text object on the band below the object that displays the date.
Use the new text object's canRender event handler to process the date
value.
function TEXT1_canRender()
this.text = cdow( this.parent.textddate1.text() )
return true
You obviously need to use the actual object name in place of textddate1.
Note the pair of brackets in .text(). An object that displays a field
has a codeblock in its text property. The () executes the codeblock so
that it returns the field's value which can then be rendered or processed.
Mervyn.
|
if file('date_day.dbf')
// drop table date_day
endif
if not file('date_day.dbf')
create table date_day (id autoinc,ddate date)
use date_day
generate 10
use
endif
** END HEADER -- do not remove this line
//
// Generated on 2016/05/21
//
local r
r = new DATE_DAYREPORT()
r.render()
class DATE_DAYREPORT of REPORT
with (this)
autoSort = false
endwith
this.DATE_DAY1 = new QUERY(this)
with (this.DATE_DAY1)
left = 75.0
top = 4815.0
sql = 'select * from "date_day.DBF"'
requestLive = false
active = true
endwith
this.STREAMSOURCE1 = new STREAMSOURCE(this)
with (this.STREAMSOURCE1.detailBand)
height = 1350.0
endwith
this.STREAMSOURCE1.detailBand.TITLETEXTID1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TITLETEXTID1)
canRender = {||this.parent.firstOnFrame}
height = 300.0
left = 1425.0
top = 50.0
width = 1170.0
prefixEnable = false
alignHorizontal = 2 // Right
suppressIfBlank = true
text = "<H3>Id</H3>"
endwith
this.STREAMSOURCE1.detailBand.TEXTID1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXTID1)
height = 293.0
left = 1455.0
top = 403.0
width = 1170.0
variableHeight = true
prefixEnable = false
alignHorizontal = 2 // Right
text = {||this.form.date_day1.rowset.fields["id"].value}
endwith
this.STREAMSOURCE1.detailBand.TITLETEXTDDATE1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TITLETEXTDDATE1)
canRender = {||this.parent.firstOnFrame}
height = 300.0
left = 4050.0
top = 5.0
width = 1080.0
prefixEnable = false
suppressIfBlank = true
text = "<H3>Ddate</H3>"
endwith
this.STREAMSOURCE1.detailBand.TEXTDDATE1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXTDDATE1)
height = 293.0
left = 4080.0
top = 403.0
width = 1080.0
variableHeight = true
prefixEnable = false
text = {||this.form.date_day1.rowset.fields["ddate"].value}
endwith
this.STREAMSOURCE1.detailBand.TEXT1 = new TEXT(this.STREAMSOURCE1.detailBand)
with (this.STREAMSOURCE1.detailBand.TEXT1)
canRender = class::TEXT1_CANRENDER
height = 300.0
left = 4080.0
top = 825.0
width = 1080.0
prefixEnable = false
text = "Text1"
endwith
this.PAGETEMPLATE1 = new PAGETEMPLATE(this)
with (this.PAGETEMPLATE1)
height = 16837.0
width = 11905.0
marginTop = 1080.0
marginLeft = 1080.0
marginBottom = 1080.0
marginRight = 1080.0
gridLineWidth = 0
endwith
this.PAGETEMPLATE1.STREAMFRAME1 = new STREAMFRAME(this.PAGETEMPLATE1)
with (this.PAGETEMPLATE1.STREAMFRAME1)
height = 11592.0
left = 360.0
top = 1365.0
width = 9360.0
form.STREAMFRAME1 = form.pagetemplate1.streamframe1
endwith
with (this.printer)
duplex = 1 // None
orientation = 1 // Portrait
paperSource = 7
paperSize = 9
resolution = 3 // Medium
color = 2 // Color
trueTypeFonts = 1 // Bitmap
endwith
with (this.reportGroup.footerBand)
height = 250.0
endwith
with (this.reportGroup.headerBand)
height = 250.0
endwith
this.firstPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.nextPageTemplate = this.form.pagetemplate1
this.form.pagetemplate1.streamframe1.streamSource = this.form.streamsource1
this.form.streamsource1.rowset = this.form.date_day1.rowset
function TEXT1_canRender()
this.text = cdow(this.parent.textddate1.text())
return true
endclass
|