Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2016 : Report Design
Message Icon Topic: Next Value from Previous Formula Post Reply Post New Topic
Author Message
lgomes
Newbie
Newbie
Avatar

Joined: 19 Mar 2019
Location: United States
Online Status: Offline
Posts: 7
Quote lgomes Replybullet Topic: Next Value from Previous Formula
    Posted: 10 Apr 2019 at 1:15pm
Hi everyone, I'm having to create a mock crosstab and each "cell" (drawn only) contains a formula.
I would like to create a formula that looks the previous formula to its left either by name or position, and give me the next value from that original formula.

So Formula 1 shows record #128. I want formula two to look at 1 and its 128 and give me #129.

Does that make sense?

Any help is much appreciated.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 8987
Quote DBlank Replybullet Posted: 11 Apr 2019 at 3:27am
what is the formula for 'cell 1'?
IP IP Logged
lgomes
Newbie
Newbie
Avatar

Joined: 19 Mar 2019
Location: United States
Online Status: Offline
Posts: 7
Quote lgomes Replybullet Posted: 11 Apr 2019 at 4:59am
The formula in cell one just looks to see if the tech selected it as the first cell, and if so - show sample id and sample type.

if {?Starting Cell} = '3-4-A'
then
{ORDTASK.ORDNO} + chr(13) +
{@SpecimenType} + chr(13)


else ""
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 8987
Quote DBlank Replybullet Posted: 11 Apr 2019 at 6:25am
So not really knowing the data I would suggest you think of this in a slightly more simple fashion.
If you can consistently determine a value that is in the "first cell" then second cell should just be that same formula "+1". Don't bother trying to reference the first cell, just use the same formula again with a "+1".
You clearly will need to move from a string to an int to do that but I think logically it is fine.

Again, I don't know your data at all but maybe something like:

if {?Starting Cell} = '3-4-A'
then
tonumber({ORDTASK.ORDNO}) + 1
IP IP Logged
lgomes
Newbie
Newbie
Avatar

Joined: 19 Mar 2019
Location: United States
Online Status: Offline
Posts: 7
Quote lgomes Replybullet Posted: 11 Apr 2019 at 6:29am
Thank you!

Except that won't work...   The Ordno(sample id) is a string so adding the +1 does not give me what I need. It's almost like I need to assign a number value to the ID's and then call those but show what they represent - in my case a string value. This has made my brain hurt for days now and I'm starting to think it can't be done.
IP IP Logged
lgomes
Newbie
Newbie
Avatar

Joined: 19 Mar 2019
Location: United States
Online Status: Offline
Posts: 7
Quote lgomes Replybullet Posted: 11 Apr 2019 at 6:34am
I also tried using next({ORDTASK.ORDNO}) but that only works on cell two. The following cells just show that second value over and over.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 8987
Quote DBlank Replybullet Posted: 12 Apr 2019 at 4:56am
if the Ordno(sample id) string is still a number (just stored as a string) then convert it and +1 then convert it back if you need to.
IP IP Logged
lgomes
Newbie
Newbie
Avatar

Joined: 19 Mar 2019
Location: United States
Online Status: Offline
Posts: 7
Quote lgomes Replybullet Posted: 12 Apr 2019 at 5:03am
Unfortunately, it's alphanumeric with a dash in the middle.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 8987
Quote DBlank Replybullet Posted: 12 Apr 2019 at 5:53am
parse it, add 1 to the number portion and then concatenate back together
IP IP Logged
lgomes
Newbie
Newbie
Avatar

Joined: 19 Mar 2019
Location: United States
Online Status: Offline
Posts: 7
Quote lgomes Replybullet Posted: 12 Apr 2019 at 5:55am
hmmmm, that might just work! I'll try it. Thank you
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.