Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: simple formula problem Post Reply Post New Topic
Author Message
paulhaggo
Newbie
Newbie
Avatar

Joined: 11 Dec 2012
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote paulhaggo Replybullet Topic: simple formula problem
     Posted: 11 Dec 2012 at 5:21am
Hello

I am pulling my hair out....  long term vb coder... not much exp with this

i am trying this formula.... it only seems to take notice of the top condition and ignore the rest

if sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No}) < 1 then 0
else if sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No}) > 0 then sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No})  
else if {SMKPLU.Product No} = 1348 then 0;


(ps... there does seem to be a way to step thorough the code at runtime, as with vb) ... is that possible is crystal

thanks
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Dec 2012 at 5:25am
where are you placing the formula?
IP IP Logged
paulhaggo
Newbie
Newbie
Avatar

Joined: 11 Dec 2012
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote paulhaggo Replybullet Posted: 11 Dec 2012 at 9:49pm
i am putting this "edit forumula".. then putting it on the report
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 12 Dec 2012 at 3:29am
Sorry, I should have been more clear...
Where on the report canvas (e.g reprot header, group header, detail, group footer, etc.) is the formula being placed. This will impact how it displays.
 
IP IP Logged
paulhaggo
Newbie
Newbie
Avatar

Joined: 11 Dec 2012
Location: United Kingdom
Online Status: Offline
Posts: 3
Quote paulhaggo Replybullet Posted: 13 Dec 2012 at 2:03am
it is it details section... i fixed this... by putting it into 3 formulas... i believe it was a type problems... such as one varible was string and one was a number... its hard when u cant step in the code
IP IP Logged
yggdrasil
Senior Member
Senior Member
Avatar

Joined: 19 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 150
Quote yggdrasil Replybullet Posted: 17 Dec 2012 at 12:16am

You can't step through the code, but you can display every part of your formula one at a time.

For example

sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No}) < 1 then 0
else if sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No}) > 0 then sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No})  
else if {SMKPLU.Product No} = 1348 then 0;
sum({SMKPLUDetail.Current Stock}, {SMKPLU.Product No})

will show you the value in that sum, but if you put
 {SMKPLU.Product No} instead on the last line it will tell you which product you are calculating on.
This is slow and annoying but does allow you to debug.

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