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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

header/column dependent on a formular to display dynamically..

Status
Not open for further replies.

rastamand

Programmer
Jan 9, 2006
2
DK
Hey folks!

I have this total sales type report. I need to display expected sales for the coming year by months(12 columns). what i want is the present month always displayed leftmost. Next month it would be feburary or the current month at any time and so forth. Is it possible to display or render columns dynamically depending on a date type formular?

Thanks for any help
 
Sure. You can use formulas like this:

//{@col1}:
if {table.date} in currentdate-day(currentdate)+1 to currentdate then {table.sales}

//{@col2}:
if {table.date} in dateadd("m",1,currentdate-day(currentdate)+1) to dateadd("m",2,currentdate-day(currentdate)+1)-1 then {table.sales}

//{@col3}:
if {table.date} in dateadd("m",2,currentdate-day(currentdate)+1) to dateadd("m",3,currentdate-day(currentdate)+1)-1 then {table.sales}

//etc.

-LB
 
thx for your respons. Im not sure i follow you. Should i put this code in the detail section formular i already made? I have summariced field also will they follow along?

note: '@col1' should hold the hole month and not from the first to currentdate, something like this:

if {table.date} in currentdate-day(currentdate)+1 to currentdate-day(currentdate)+ /*some date evaluation on month incl leap year.. hmm*/ then {table.sales}

btw CR 10
 
The first formula should be:

if {table.date} in currentdate-day(currentdate)+1 to
dateadd("m",1,currentdate-day(currentdate)+1)-1 then {table.sales}

These are detail level formulas. If you want the page headers to be dynamic, use formulas like the following instead of the automatic column labels:

//{@col1header}:
totext(currentdate,"MMMM yyyy")

//{@col2header}:
totext(dateadd("m",1,currentdate),"MMMM yyyy")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top