Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Chage Y Position of an object

Status
Not open for further replies.

BradCustom

IS-IT--Management
Oct 5, 2007
296
0
0
US
I'm using Crystal Reports 2011
Does anyone know if it is possible to change the Y Position of an object (subreport in this case) based on a value?

Thanks,
Brad
 
Do you mean the vertical position of the subreport? Are you trying to align it with other fields/objects? Please explain what you are trying to do. Without any additional info, I might suggest inserting additional report sections that are conditionally suppressed based on a value.

-LB
 
LB
Yes, I mean the vertical position of the subreport. I'm trying to conditionally move the subreports based on the current month.
My report structure is as follows; Main Report with 12 subreports (1 for each month). I would like to display a 3 moth rolling calendar. For example: If the current month is January (1) then display Oct, Nov and Dec. unfortunately the subreports are to large to place them side by side so they are placed in the report footer one under the other with enough room between so that they don't overlap. The way I'd like to do it is to change the position of the subreport from position 1 to 2 and then to 3 as the month value changes. If it's possible (which I don't think it is) it would be better than having 36 subreports and doing conditional suppressing based on the current month.

Thanks,
Brad
 
If you place each sub in its own RF Section, you can conditionally suppress the section based on current month number. For example, the February subreport section would be suppressed with a formula like this:

//February suppression formula:
Month(currentdate)<>[3,4,5]

-LB
 
LB,
Yes that would work but I think the positioning of the subreports wouldn't be in the correct sequence. This is what I think might happen.
lets say we have 12 RF sections as below.
RF1 January
RF2 Febuary
RF3 March
RF4 April
RF5 May
RF6 June
RF7 July
RF8 August
RF9 September
RF10 October
RF11 November
RF12 December

So if the current month is January then Oct, Nov and Dec are shown in order. If the current Month is Feb then Jan, Nov and Dec are shown in that order.
At least I think that's what will happen. Do you also think it will display that way?

Thanks,
Brad
 
Is this report used for other purposes? If you always only need the last three months, why wouldn’t you set up one report that selects data for the last three months, and then group by month and year in descending order?

-LB
 
LB,
Obviously that is a much better way to do than my 36 subreport approach. Unfortunately I haven't been able to restrict the record selection to the past 3 months based on the current month. Any ideas?

Thanks,
Brad
 
LB,
I found this formula in another thread and it seems to work fine.

Code:
{ORDER_HISTORY.MODIFIED_DATE} in dateadd("m", -3, ((date(year(currentdate), month(currentdate),01)-1)))+1 to (date(year(currentdate), month(currentdate),01)-1)

Thanks,
Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top