How to get Y position of detail on the report?

Hi all.
I have report with many details.
Report has definition:


det1 DETAIL,AT(,200),USE(?det1)


det2 DETAIL,AT(,500),USE(?det2)


det3 DETAIL,AT(,1000),USE(?det3)



I print them in source code using :

loop i=1 to x


Depends on x variable the report has 1, 2 or more pages.
Position of det2 on the report is changing.
My question is , how to detect ypos of printed det2 on page?


PROP:At             EQUATE(7C02H)  ! array[integer] (4 values)
PROP:Xpos           EQUATE(7C02H)  ! integer, equivalent to PROP:At[1]
PROP:Ypos           EQUATE(7C03H)  ! integer, equivalent to PROP:At[2]
PROP:Width          EQUATE(7C04H)  ! integer, equivalent to PROP:At[3]
PROP:Height         EQUATE(7C05H)  ! integer, equivalent to PROP:At[4]


Check “AT (set position and size)” in the doc

I know it, but
?det2{prop:Ypos} returns 0.
Report$?det2{prop:at,2} returns 0
I my example, det2 is printed in the middle of the page.
I want to know how far (in millimeters) from top edge of the page.

I’m not aware of a documented way to get what you’ve asked for.
There likely is an undocumented way, but I don’t know what it is.

So, let’s back up. WHY are you asking for the Y Position?

If I had to guess, it’s so that you can decide which bands to print, and to handle page overflow.
In which case see the following attributes that you can add to a DETAIL band


You can also use property syntax, to alter the HEADER and FOOTER bands

If you really need to control the locations of a detail band, you can use the ABSOLUTE attribute

1 Like

Det2 detail is a section with the name and signature of user issuing an invoice.
I generate pdf from the report and insert an electronic signature into it.
The signature widget must hit into det2 exactly.

OK, so I think I’m hearing that a particular detail band needs to be at a specific location on the page
If so, then use the ABSOLUTE attribute

It can be a big PITB, if you don’t know the Y position of the last printed non-absolute detail. So even if you use ABSOLUTE on the one detail, you still have the same issue.

I wrote a report flow class to track the positions so I’d know where to place absolute details or whether the next PRINT() will flow to the next page, but it’s not mine to share.
If all of the details are of a fixed height, then it’s not so difficult. Otherwise, you need to loop through the controls of the detail to determine what the next height (including resizable controls, like TEXT) will be then add that to the tally. A lot of time and cursing was involved before I got it working correctly, btw.

1 Like

The REPORT Engine is designed for you to NOT know the position of details or page breaks so it can do Widow/ Orphan control and other features to flow details nicely.

It is possible to do manual page breaking so that you can know the YPos of a Detail because you have counted all the Heights of what you have printed and done your own ENDPAGE(). You must NOT use any of the features @MarkGoldberg described, like WITHPRIOR, otherwise the Report Engine will be doing things you don’t know about,

One other thing you must do is set the Prop:MaxHeight=Prop:Height for all DETAILs or the Engine will expand their height a little sometimes. You also want your Band Area Height (the Report AT(,H)) to be bigger than you need so the Engine does not hit overflow. That way if you mess up you’ll see your details print in the Footer area.

My GIST below has a Template to do the MaxHeight plus place the Band Height into a variable for use in counting. There is also a simple ManRpt Manual Report class to assist.

What about using a FOOTER instead of DETAIL for the signature?

Too large gap between detail and footer. It looks ugly…
For the first time, clarion disappointed me.

The ONLY way to know for certain is to use fixed height details and subtract the height of each printed detail from the report AT() which defines the region usable for details and group headers and footers. It’s like we did in DOS, you had to count the lines to know when a page was going to overflow.

The only other way to know a page overflow is happening is to force it using ENDPAGE() otherwise with orphan and widow control you can have multiple “pages” in memory waiting for your conditions to be met for both orphan and widow.

Use fixed height details and keep tabs on how much of the report AT() has been used before each detail is printed, then you’ll know where it is, again, assuming no orphan or widow control.

1 Like