INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

help logic

help logic

(OP)
I've a scenario where I need summary by account group. here are two tables that I need to connect.
1) journallines having fields glaccountid and amount
2) accountgroup having fields groupid, glaccountidm, glaccountidl and glaccountidoh
(m-material, l-labour and oh-overhead)
journallines can have at any point of time (each record) either of glaccountidm, glaccountidl and glaccountidoh and amount. I would like to summarize information by account group for each category (m, l and oh). How do I connect tables and summarize data. If I'm vague in exaplining the scenario then please let me know.
many thanks in advance.

RE: help logic

If I understand you correctly, the journallines.glaccountid value can be found in accountgroup.glaccountidm, accountgroup.glaccountidl, or glaccountidoh, is that correct?

I think your best bet for setting this up is going to be to use a Command instead of the tables because Crystal is not going to let you link the table correctly. A Command is just a SQL Select statem/ent. You will probably have to tweak this, but your command would look something like this (this assumes that glaccountidm, glaccountidl, and glaccountidoh will ALL always have values in them):

CODE

Select
  ag.groupid,
  ag.groupname,
  sum(case when jl.glaccountid = ag.glaccountidm then jl.amount else 0 end) as material_amount,
  sum(case when jl.glaccountid = ag.glaccountidl then jl.amount else 0 end) as labor_amount,
  sum(case when jl.glaccountid = ag.glaccountidoh then jl.amount else 0 end) as overhead_amount
from accountgroup as ag
  left join journallines jl on 
    jl.glaccountid = ag.glaccountidm or
    jl.glaccountid = ag.glaccountidl or
    jl.glaccountid = ag.glaccountidoh
group by ag.groupid, ag.groupname 

This will do your summaries for you instead of having Crystal summarize the data.

A couple of things to note when working with commands:

1. You want to try write a query that will return ALL of the data for your report, if possible. When you link a command to a table or use multiple commands, Crystal will pull in all of the data from both and then do the join in memory.

2. If you need to filter the data, you need to do that in the where clause of the command. This also means that if you're using a parameter, you need to create the parameter IN THE COMMAND and not in the report.

-Dell

DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year
www.decisionfirst.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close