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!

print last and last +1 reocrd

Status
Not open for further replies.

jonav

Programmer
Nov 14, 2011
69
US
Hi,

I trying to print last record using onlastrecord function and it is working fine but I would also like to print lastbeforerecord.

pls help,

thanks
JN
 
If you are talking about printing just one field as it occurs in the last and next to last record, you can drag the field into the footer section, resulting in the last instance of the field and then add a formula like this for the next to last record:

previous({table.field})

If you want the entire rows, then use a suppression formula on the detail section like this, where {table.field} is a recurring field (non-null):

recordnumber < count({table.field})-1

If you are trying to do this within a group, you would have to replace recordnumber with a running total that resets on change of group and you would have to add the group condition to the count function.

-LB

 
HI lbass,

I'm using the below formula to print the number on last record

if onlastrecord then
"1234"

Also tried with if onlastrecord and previous(dealfield) then
"1234"

but i'm getting an error on previous function.

Pls advice,

thanks,
JN
 
onlastrecord AND previous(dealfield) won't work since the previous field can never be on the last record. What is the point of returning a specific number on the last record? Are you trying to print the same number on the last two records? IF so, then use:

if recordnumber >= count({table.field})-1 then
"1234"

-LB
 
Not exactly the same number
I'm using a group on Media and Deal Number. printing this number in Media Grpfooter.

I'm also doing a hierarchy on Media. so drilling down the Media and would like to print this number on last level and before the end of last level.

Media
lvl1
lvl2........lvln
Upon drill down it opens on each tab.

So I want to print a number on "lvln" and also on "lvln-1"

Pls let me know if this is possible.

I'm writing formula with onlastrecord which is working fine. but when I add your formula. it is printing on lvl1.

Let me know if I'm missing anything

Thanks,
JN
 
I don't understand what field lvl1 and lvl2 are coming from. Are these instances of a group?

You say you have a group #1 on Media and a group #2 on deal number. Please show some sample data that shows media, deal number and whatever lvl1 is. What do you mean by "doing a hierarchy on media"--are you using the hierarchical group function?

Also explain your drilldown setup. What sections are hidden, what ones are suppressed, etc.

-LB
 
Please just answer my questions. I don't want to go to links.

-LB
 
I don't understand what field lvl1 and lvl2 are coming from. Are these instances of a group?

---> LVL1 nad LVL2 are comming from Deals which is a group

You say you have a group #1 on Media and a group #2 on deal number. Please show some sample data that shows media, deal number and whatever lvl1 is. What do you mean by "doing a hierarchy on media"--are you using the hierarchical group function?
---> Using a Hierarchical Group Option. I sent the report sample to you an idea how I'm grouping and doing the hierarchy.

Also explain your drilldown setup. What sections are hidden, what ones are suppressed, etc.
--> Drilling on Media and also deals..

Media1
Deal1
Deal11
Deal12
Deal13
Deal2
Deals21
Deal22
Deal23
Media2
....... and so on

We are not sure how many levels will be there for Media or Deals.

All I would like to print is the number onlastrecord and previousonlastreocord.. like
Media1
Deal1
Deal11
Deal12
Deal13 300900(previousonlastrecord)
Deal2
Deals21
Deal22
Deal23 300902(Onlastrecord)

Let me know if this helps.

Thanks
JN
 
Try this:

Create a running total {#deal} that does a distinctcount of {table.dealparent} (your deal group level), evaluates for each record, resets on change of {table.media}.

if (
onlastrecord or
{table.dealparent} <> next({table.dealparent})
) and
{#deal} in distinctcount({table.dealparent},{table.media})-1 to
distinctcount({table.dealparent},{table.media}) then
{table.number}

-LB
 
Thanks Lbass,

What if I have just one group?.
What would be the formula though?.

Sorry to bug you like this but your formula always works out for me..

Thanks again,
JN
 
Grouping on just deal and not media.

Using a Hierarchical Grouping option under the "Report" Tab. I'm able to display the Deal as drill down hierarchy.

Is it possible to display the number as we did it for 2 groups.
 
My last solution was for two numbers, one on each of the last two deal groups within each media group. Please explain what results you saw and how that differed from what you wanted.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top