Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: command table? Post Reply Post New Topic
Author Message
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Topic: command table?
    Posted: 07 Mar 2019 at 4:36am
I am using the following Case statement in my Command Table SQL (oracle) script.

CASE
    WHEN
      bl.bag_type_cd IN ('DOUBLE CPD','TRIPLE CPD') THEN MOD(biad.reference_value,10)

    WHEN
      bl.bag_type_cd IN ('ALYX RBC','PLAS PHER') THEN MOD(biad.reference_value,6)

    WHEN
      bl.bag_type_cd = 'PLT PHER' THEN MOD(biad.reference_value,3)

    ELSE 99
END AS remainder


I would like to be able to use the"remainder" field in my WHERE statement and say

WHERE
remainder<>0

Does anyone have any suggestions? If there is a better forum for this question please let me know.

CJB
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 07 Mar 2019 at 6:10am
This is actually a SQL question rather than a Crystal question.

There are a couple of ways to go about this.

1. Put the entire case statement in the Where clause instead of referencing the field.

2. Leave the condition out of the where clause of your current query. Then set up an outer select statement that looks something like this:

Select *
from (
current query
) as data
where data.remainder <> 0

-Dell
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 07 Mar 2019 at 6:12am
You might also want to look at this blog post for more information about using commands:

https://blogs.sap.com/2015/04/01/best-practices-when-using-commands-with-crystal-reports/

-Dell
IP IP Logged
cbaldwin
Groupie
Groupie


Joined: 09 Apr 2014
Online Status: Offline
Posts: 81
Quote cbaldwin Replybullet Posted: 07 Mar 2019 at 6:16am
Thanks for the input. I will try option 2.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.