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

sort formula field alphabetically

Status
Not open for further replies.

hsandwick

Programmer
Sep 10, 2001
286
US
crystal reports 9
sql server 7
visual basic custom application

I have a main report and a subreport linked by filename.
The subreport results are driven by a table containing entity ids (fields share this table depending on the scenario).
I then present results of a particular field on the subreport based on the entity id for that field.
Problem is, the report sorts by the entity field (I have a group for this), and no matter what way I try, the actual "Name" field in the subreport appears with no sorting. I need "Name" to appear alphabetically.
Have tried working with group expert options, every which way, nothing works. If I change the group to the "Name", the results are wrong or empty.
Is there a way to sort "Name" "while printing records" or soemthing along those lines?

Thanks very much.

Helen
 
If you group by just the name, the results will be sorted by the name.

Where is the subreport within the main report?

If it's in a group, and linked on that group, then it will be sorted by the group in the main report.

Try sharing the following:

Example data
Expected output

-k
 
Thanks, synapsevampire. Unfortunately it's not so straightforward. Normal grouping would work. This is a denormalized db, and we're relating entity ids in a major table that link to multiple other tables, so it's not possible to group on the field I want - I would only end up with coded data. The subreport has to be grouped based on the MIdentity in order to create the right relationships. From there, I can pull in a formula on the subreport that shows specific type names, based on two identity types.

So, I'm not able to group by the formula field. I have to group by the major identity type and translate the names from there. That's my quandary. I can't group the resulting names or sort the names and that's what I need. I can only group/sort the entity ids
 
Grouping has nothing to do with relationships, assuming that you mean relationships between tables.

Rather than text descriptions, please post example data and expected output:

-k
 
samples of the entity ids referred to as customdataMID in the subreport group.
4B641463FGS030
4B641FB41BS030

Then,
"Ocean Waves Hotel"
"Dr. Ricky Roach"
are samples of the Cases that result in the subreport, based on customdataMID being true, and also the Cases must be of entity type customdataTplDID.

Because of denormalization, if I test "Change Group" on Group Header
to the actual field that links to tpldid which is Command.NameFull (also used in a multitude of other scenarios, depending on the tplDID), I only see some of the cases appearing in the group, and/or only some/none of the other data appearing in the subreport.

I'm using variables in the subreport, and this one is

IF {Command.CustomTplDID} = '4B641469CVS030' THEN RecordsProvider := {Command.NameFull};

Have tried different groups, no groups and everything in between.

I have @resetvars in the subreport group header, and @collectvalues in the details. I have @declarevars in the main report to print results once = FALSE or TRUE.

It all works perfectly as long as I don't need to order the cases alphabetically. But now I do.

Thanks very much for your help and ideas.

Helen
 
I don't need to know how your data is currently being displayed, I need to know how the data exists in the
table(s) involved, and what you need for output.

Text descriptions often times make sense to the poster, but not to me.


Note: "fields share this table depending on the scenario"

How can a field share a table?

There's not much technical for me to sink my teeth into. please provide:

Table1:
field1 Field2 Field3
12345 Hello World
23456 Goodbye World

Table2:
field1 Field2 Field3
12345 Sayonara World
23456 Tak World

Then show the relationship, and what the output should look like.

-k
 
Sorry not to respond sooner, some internal requirements and deadlines. Issue has been resolved. Needed to create table aliases and work from there.

-Helen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top