Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Random: Sharing Two Variables with a Conditional Post Reply Post New Topic
Author Message
bpmcnary
Newbie
Newbie


Joined: 09 Dec 2012
Online Status: Offline
Posts: 17
Quote bpmcnary Replybullet Topic: Random: Sharing Two Variables with a Conditional
     Posted: 08 Oct 2013 at 2:24am
Hi Guys,
 
I've been using a specific formula to drive my shared variables. The formula was built using a plug value, so it's within a pretty large conditional statement (the below is truncated).
 
For example -- this is my total assets formula:
 
Shared NumberVar Assets_MF;
Shared NumberVar Assets_SF;
 
IF {Main.Main Fund or Parallel Fund} = "Main Fund"
    THEN Assets_MF :=
{@Shared - SOI - FairValue}+
{@Cash Flows - Total - Total}+
{@Assets - Deferred Costs}+
{@Assets - Due from Related Parties}+
 
    ELSE Assets_SF:=
{@Shared - SOI - FairValue}+
{@Cash Flows - Total - Total}+
{@Assets - Deferred Costs}+
{@Assets - Due from Related Parties};
 
 
In certain cases, the shared variable will give me something completely wrong -- maybe a portion of the IF statement. If my total assets number is 1 dollar, I could potentially get a number like 1,000,000 from the shared variable. Not entirely sure why this is happening, I think I have a few work arounds I could use to get the numbers I need, but I was wondering if you all had any suggestions on how I could better write my formulae?
 
Any suggestions would be appreciated!
 
Thanks,
Brandon
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 08 Oct 2013 at 5:11am
in the abbreviated code...
you only set 1 variable or the other. Do you re-initialize the variables somewhere else.

if MF is set last time, and this time you should be setting SF, MF will still have the same value as the last run...unless the variables are set somewhere else.

just my first observations.
IP IP Logged
bpmcnary
Newbie
Newbie


Joined: 09 Dec 2012
Online Status: Offline
Posts: 17
Quote bpmcnary Replybullet Posted: 08 Oct 2013 at 5:37am
Hi Lockwelle,
 
Thanks for the response. The end product is a reconciliation. I wanted a side by side comparison of total assets from Main Fund (MF) and from Second Fund (SF). The only thing is, is that sometimes it gives me a very wrong number... I wasn't sure if it was processing the entire conditional or maybe my syntax was wrong. The formula is missing about 10 other formulae, so when the if statement is combined, it's like 30 lines long.
 
Thanks,
Brandon


Edited by bpmcnary - 08 Oct 2013 at 5:41am
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