Print Page | Close Window

Using "previous" function

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=12539
Printed Date: 02 May 2024 at 9:27am


Topic: Using "previous" function
Posted By: Pushrod
Subject: Using "previous" function
Date Posted: 08 Mar 2011 at 6:20am
I am creating a report that reports document access. In the details area I have PEOPLE_1.FULL_NAME and GROUPS.GROUP_NAME on top of each other so both are displayed for each document. There is also a formula to display the type of rights for people and groups.
 
Because duplicates are displaying for each version of the document I used the "previous" function like this:
{GROUPS.GROUP_NAME} = previous ({GROUPS.GROUP_NAME})
 
This works great for the groups but I also want to do the same for people, so I tried:
{GROUPS.GROUP_NAME} = previous ({GROUPS.GROUP_NAME}) and
{PEOPLE_1.FULL_NAME} = previous ({PEOPLE_1.FULL_NAME})
 
The result is the GROUPS and PEOPLE are not duplicated for each version of the document and the type of rights for each group are correct but only the first people rights are displayed, the rest are blank (as if the "previous" function is not working on people).
 
Please advise.
 
 



Replies:
Posted By: Keikoku
Date Posted: 08 Mar 2011 at 7:51am
Is this a suppression formula?
Is it on the specific field?

In formula workshop if you go to formatting formulas and expand details, you should see your report fields. You then define the conditions that they should be suppressed.

So for GROUP_NAME you would use the one you wrote, and for people you would write "{PEOPLE_1.FULL_NAME} = previous ({PEOPLE_1.FULL_NAME})" there.

You may have accidentally suppressed entire records.


Posted By: Pushrod
Date Posted: 08 Mar 2011 at 10:06am
I have a formula that is an if statement that says if security.accessrights is a certain number then display a string. And this formula is working on both the GROUP and PEOPLE to give their accessrights. But because there are versions of the documents these PEOPLE and GROUPS are duplicating. So I put a "Suppress If Duplicated" on the formula and added the "previous" function indicated in my first post, but it only seems to work on either GROUP or PEOPLE but not both.


Posted By: Keikoku
Date Posted: 09 Mar 2011 at 2:52am
If you right-click --> format field --> suppress if duplicated I believe it will suppress the entire record. Unless you have found that it only suppresses the particular field (I had run into errors when I did a careless suppression and was missing important data).


Posted By: lockwelle
Date Posted: 09 Mar 2011 at 3:18am
are you grouping by People as well, or just Groups? if not, I would try grouping by People as well, then the rights should align.


Posted By: Pushrod
Date Posted: 09 Mar 2011 at 4:49am
In the formula workshop, under Formatting Formulas, on the Details section I have a formula I called "RightsFormula". I right clicked on that formula and made a new Formatting Formula on Suppress If Duplicated.
 
So with:
{GROUPS.GROUP_NAME} = previous ({GROUPS.GROUP_NAME})
I am suppressing the duplicate results that came up.
 
The duplicates were: the same GROUP and it's "rights" would show up for each version of the document.
 
Using the "previous" function fixed this problem.


Posted By: Pushrod
Date Posted: 09 Mar 2011 at 4:50am
Actually the report is grouped by Document Number


Posted By: lockwelle
Date Posted: 10 Mar 2011 at 3:37am
would it hurt the report to order by groups and people? If not, that is something to try.  If it is being ordered by date, and the groups and people interleave....
 
I don't think that I fully understand what you are wanting.  It sounds like you want to display rights for groups and people for a document that changes.  If you do this in a group header, it will only look at the record that is current for that group header at that  moment.  If it is being done in the detail section, then the sort order will matter as to what the previous record is. 
 
 


Posted By: Pushrod
Date Posted: 10 Mar 2011 at 5:31am

Thanks for trying to help. I think you have the basics of what I am trying to do, unfortunately I cannot change the grouping.

Is there a way to upload a sceen shot of my report?


Posted By: Keikoku
Date Posted: 10 Mar 2011 at 6:35am
hit printscreen on your keyboard, open an image editor like paint, paste it, then upload it to an imagehost and post it here via BBcode.


Posted By: Pushrod
Date Posted: 10 Mar 2011 at 7:57am
Well I know how to make a screen shot but do not have an imagehost and don't know what BBcode is. I am working within a government firewall.


Posted By: Keikoku
Date Posted: 10 Mar 2011 at 9:33am
I would say use a public host but your report may contain confidential data so that might not work.

However if you are able to provide dummy data, then using a public host like imgur.com should be enough. Then the question becomes whether you can access it or not.

Or you can type up an example record manually


Posted By: Pushrod
Date Posted: 10 Mar 2011 at 11:26am
Yeah, working for the government means almost all sites are blocked.
 
Anyway here are the results in the Details section:
 
First I got:
 
First Group         Read Only
                          Read Only
                          Read Only
Second Group    Read Only
                          Read Only
                          Read Only
First User           Full Access
                          Full Access
                          Full Access
Second User      Full Access
                          Full Access
                          Full Access
 
And that result was because the report was showing the same access for each version of the document. So I put Suppress If Duplicated on the rights formula and got:
 
First Group       Read Only
Second Group
First User         Full Access
Second User        
 
So I put "previous ({PEOPLE_1.FULL_NAME}) = {PEOPLE_1.FULL_NAME}" on the Suppress If Duplicated and got:
 
First Group        Read Only
Second Group
First User           Fulll Access
Second User      Full Access
 
So then I put "previous ({PEOPLE_1.FULL_NAME}) = {PEOPLE_1.FULL_NAME} and
previous ({GROUPS.GROUP_NAME}) = {GROUPS.GROUP_NAME}" thniking I would now get the Second Group access but did not.
 
 



Print Page | Close Window