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

How To Group list of names using formula

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I'm currently encountering this problem. Would somebody out there help me to solve it.

///////////////////////FORMULA/////////////////////////////
Local NumberVar consult;

if {REPORTDATA.STAFFID} = {?SID} and Uppercase({REPORTDATA.ITEM}) = Uppercase("cVisit") and NumericText ({REPORTDATA.READING}) then consult:=ToNumber({REPORTDATA.READING});
consult;
///////////////////////FORMULA/////////////////////////////
I'm using this formula to group a list of names. If the ({REPORTDATA.ITEM}) is not "cVisit", the ({REPORTDATA.READING}) will be converted to 0 and 0 will be part of the group field. Is there any way where i can opt names under 0 reading from the group?
 
Hi "peisy"

You said.....
"......If the ({REPORTDATA.ITEM}) is not "cVisit", the ({REPORTDATA.READING}) will be converted to 0 ...."

How it will be converted to zero is not clear to me.

Also following is also not clear to me:
"...Is there any way where i can opt names under 0 reading from the group?"

Please explain again what are you tryinig to do.
I guess you are trying to give a differnt names to the records that do not match the condition , you may use following formula :

///////////////////////FORMULA/////////////////////////////
if {REPORTDATA.STAFFID} = {?SID} and Uppercase({REPORTDATA.ITEM}) = Uppercase("cVisit") and NumericText ({REPORTDATA.READING}) then ToNumber({REPORTDATA.READING})
else 0
///////////////////////FORMULA/////////////////////////////

Please explain your problem clearly so that I can help you in a better way.

--PKG
*************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Hi PKG,
The problem is that in the database under the ({REPORTDATA.ITEM}), the items mainly are: cVisit, sysBP, diasBP, blah blah blah....I want to extract the ({REPORTDATA.READING}) with item as "cVisit".
The result generated by the formula would be, for example, 8, 6, 3, 2 and 0. Thus, the list of names will be grouped under these group fields. However, is there any way where i can opt out the 0 field from the formula? Therefore, only group field 8, 6, 3 and 2 will be shown. Hope you can have a better understanding of my problem facing now. Thank you.
 
Hi "Peisy"

Its more clear now.
There are two ways doing this :

1) Go to select expert and write a formula that excludes all records having {REPORTDATA.READING} <> &quot;cVisit&quot;.

2)In the group (header & footer) write a suppress formula liek :
{REPORTDATA.READING} <> &quot;cVisit&quot;

Let me know if that doesn't solve your problem.

--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Ermm....I think you have misunderstood me. I never want to opt &quot;cVisit&quot; in my report. Instead, i want to opt out cVisit with reading as zero only

Using the formula above, the result generated will be, for example: 8, 6, 3 and 0.
Under the grouping field,
8
Alice, Mickey, Duncan
6
Carol, Christ
2
Joshua
0
Bunny

How do i opt out Bunny under 0 group field in my report?
 
OK then modify the formula like this:

1) Go to select expert and write a formula that excludes all records having {REPORTDATA.READING} = 0.

2)In the group (header & footer) write a suppress formula liek :
{REPORTDATA.READING} = 0

Is that right now ??

--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Hi PKG,
if i were to use the method 2, isn't it the whole group will be suppressed including the reading, 8, 6 and 2. Can i just supress the reading with zero only?
 
Don't do guess work!! Try it and see the results.
You will write a suppress formula that will conditionally suppress the sections.

--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Hi PKG,
I had tried the suppress formula but it seems that t can only suppress the whole section and not just the part with the the reading zero.
 
I thought you want to suppress the whole section. But if you don't want that then write the suppress formulae for the individual items that you want to suppress.


--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Pardon me for asking you how do i suppress for each individual group name? I only know there's formula available for suppressing the whole section but i can't see any formula for suppressing an individual item.
 
Right click the field that you want to suppress, click format field and there you will find the suppress check box and conditional suppress formula button.
By this method you won't be able to suppress the lines, boxes etc.

--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Ho PKG,
Is there anyother methods i can use because the grouping are within boxes. Thank you.
 
There may be other methods of achieving your need. But I would be able to tell you only after knowing exactly what you want to do. Can you tell me what all things are there in and between the group headers and footers.

Meanwhile do any of the follwing:

1) Use text-fields instead of boxex.

2) Insert another group headers and footers. Now among these two sets of headers suppress (conditionally) each one for two conditions i.e.
{REPORTDATA.READING} = 0 and
{REPORTDATA.READING} <> 0

Now place the things that you want to place for {REPORTDATA.READING} = 0 in the section for which suppress condition is {REPORTDATA.READING} <> 0
and vice versa.

--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
The output now is like:

-----------------------------------------------------
| 8 |
| Lisa |
| 6 |
| Christ |
| 3 |
| Mickey |
| 0 |
| Bunny |
| |
------------------------------------------------------
Can i make it into like this output:


-----------------------------------------------------
| 8 |
| Lisa |
| 6 |
| Christ |
| 3 |
| Mickey |
| |
------------------------------------------------------
 
Your example shows that you want to suppress the whole section containing:

| 0 |
| Bunny |

But you said that...........
&quot;...I had tried the suppress formula but it seems that t can only suppress the whole section and not just the part with the the reading zero...&quot;

This is a bit confusing.
can you send the rpt file or the screen dump to me at
pradeep.gupta@morganstanley.com

Or if possible phone me at following India number:
91-20-7601000, 7691111, 7691100 Ext 1578

--PKG *************************
Pradeep Kumar Gupta
Data Warehouse Consultant.
E-Mails: pradeep.k.gupta@indiainfo.com
pradeep.gupta@morganstanley.com
 
Hi Peisy & PKG,

I'm not sure whether i understand exactly what the problem is, but can't you just right-click GH1(if this formula is your first group) on the left panel, then go to Format Section... In the Section Expert, click the formula editor for the Supress (No Drill Down) and type in this formula : {@yourFormula} = 0
Then do the same on the D and GF1 section.

I'm not sure whether this is the best solution though (since i'm also a newbie to crystal report). But i hope this helps.

May
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top