Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Finding results with 0 movements Post Reply Post New Topic
Author Message
nosfuratu
Newbie
Newbie


Joined: 07 May 2009
Online Status: Offline
Posts: 2
Quote nosfuratu Replybullet Topic: Finding results with 0 movements
     Posted: 07 May 2009 at 9:37pm

Hey guys,

Hopefully you'll just see this and go...id10t...because it will be all so simple :)

If I am trying to find a debtor account that has 0 movements transactions between certain dates...How do I do it....

I mean generally, finding accounts that have had the movements between dates not a problem, I have found the fields and got all those constraints down without a worry...but if someone does not have any movements there, it does not display them (which generally is what you want)....

Help???

Thanks,

Nos

IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 08 May 2009 at 1:16am
Hi
 
What you can do is check for the values in the fields
 
i.e. as you say  finding accounts that have had the movements between dates not a problem so check for the values in these fields i.e how do you know that they had movements between dates so to check for 0 movements just negate or do the opposite to find 0 movements.
looking at the post you can check for null values or spaces in the fields i.e
 
IF ISNULL({table.fieldname}) or {table.fieldname} = " " then
"No Movements"
 
hope that helps.....
 
Cheers
Rahul


Edited by rahulwalawalkar - 08 May 2009 at 1:18am
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 May 2009 at 7:18am

Depending on your data you have to be careful with your joins and your select statement. This type of thing is usually easier to get with views or stored procedures. If you cannot do that one way is to pull all of your debtor accounts into the report and flag items that DO have results that fall into your time frame and then remove them using a group summary selection.Based on your overall needs you have to tweak this but here is a basic process. Also this assumes that each debtor record has at least one record transaction for it. If not you will run into some NULL issues that this process will omit it as a record.

Group on the debtor account field.
Create a formula to count records that fall int he time frame. Assuming you want to use user defined parameters it would look something like:
if {table.datefield} in {?parameter start date} to {?parameter end date} then 1 else 0
Use the summary function to create a SUM of this formula field at the debtor account group level.
from here you now have determined that any debtor account with a SUM of 0 had no transactions (this is where you will have issues if the debtor account has no transactions at all.instead of a 0 it will be null as a summary)
You can now do a summary selection criteria. CLick on the summary field and then click on the record selection.
You should be able to add in the group selection criteria of:
Sum ({@formulafield}, {table.debtoraccount}) < 1
Make sure in the select expert you have the Group Selction option toggled on. This cannot go in the Record selection portion.
IP IP Logged
nosfuratu
Newbie
Newbie


Joined: 07 May 2009
Online Status: Offline
Posts: 2
Quote nosfuratu Replybullet Posted: 10 May 2009 at 5:24pm
1st off, thank you for your replies....although i'm not sure either of your situations can help me fully...I have looked into what you're saying, perhaps I didn't portray accurately my situation....(which is hard over text :P)
 
Ok, i'll give an easier scenario....ignoring a movement situation....we have 2 tables {product} and {supplier}....every product is meant to have a supplier against it....
if i put into crystal the two fields i.e. {product.name} and {supplier.name} it will only list the products who have a supplier against them...not the other way around...how can i reverse the results?
 
Thanks,
Nos
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 10 May 2009 at 6:17pm
Add your tables to the report and do a left outer join.
IF you want all suppliers who have no product do the left join from Supplier table to Product table.
In your select statement look for nulls in the supplier table
isnull({product.name})
If you need it the other way around inverse the join and look for nulls in the supplier table.
IP IP Logged
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