Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Help with Command Table Post Reply Post New Topic
Author Message
MrMitch5150
Newbie
Newbie


Joined: 06 May 2009
Online Status: Offline
Posts: 1
Quote MrMitch5150 Replybullet Topic: Help with Command Table
     Posted: 06 May 2009 at 11:49am
Hi all,
 
I fairly new to Crystal, and hoping someone could help me out with a problem I seemed to have run into. 
 
I am using Crystal XI, with ODBC.
 
I basically just need this:
 

If ISNull({CNC_ACTIVE__CONTRACT_ITEM.Rate_Table_Labor}) or
trim({CNC_ACTIVE__CONTRACT_ITEM.Rate_Table_Labor})=""
Then "EMES"
else
{CNC_ACTIVE__CONTRACT_ITEM.Rate_Table_Labor}

 
put into this SQL statement:
 
 SELECT "PRT_CURRENT__TIME"."Units",
"PRT_CURRENT__TIME"."Job",
"PRT_CURRENT__TIME"."Extra",
"PRT_CURRENT__TIME"."JC_Cost_Code",
"PRT_CURRENT__TIME"."Date",
"PRT_CURRENT__TIME"."Pay_Type", "PRM_MASTER__EMPLOYEE"."Employee_Name", "PRM_MASTER__EMPLOYEE"."Department", "CNC_ACTIVE__CONTRACT_ITEM"."Rate_Table_Labor", "PRT_CURRENT__TIME"."JC_Category", "BLS_STANDARD__RATE_TABLE_DETAIL"."Unit_Price"
 FROM  
(("PRT_CURRENT__TIME" "PRT_CURRENT__TIME" INNER JOIN "CNC_ACTIVE__CONTRACT_ITEM" "CNC_ACTIVE__CONTRACT_ITEM" ON ("PRT_CURRENT__TIME"."Job"="CNC_ACTIVE__CONTRACT_ITEM"."Job") AND ("PRT_CURRENT__TIME"."Extra"="CNC_ACTIVE__CONTRACT_ITEM"."Extra")) INNER JOIN "PRM_MASTER__EMPLOYEE" "PRM_MASTER__EMPLOYEE" ON "PRT_CURRENT__TIME"."Employee"="PRM_MASTER__EMPLOYEE"."Employee") INNER JOIN "BLS_STANDARD__RATE_TABLE_DETAIL" "BLS_STANDARD__RATE_TABLE_DETAIL" ON ("PRT_CURRENT__TIME"."JC_Category"="BLS_STANDARD__RATE_TABLE_DETAIL"."Category") AND ("CNC_ACTIVE__CONTRACT_ITEM"."Rate_Table_Labor"="BLS_STANDARD__RATE_TABLE_DETAIL"."Rate_Table")
 WHERE   NOT ("PRT_CURRENT__TIME"."Pay_Type"='Accrual' OR "PRT_CURRENT__TIME"."Pay_Type"='Other') AND ("PRT_CURRENT__TIME"."Date">={d '2009-04-05'} AND "PRT_CURRENT__TIME"."Date"<={d '2009-04-11'}) AND "PRT_CURRENT__TIME"."Job" LIKE '__-______-__'

So it will replace those nulls or blanks with "EMES" before it starts looking up on the "BLS_STANDARD__RATE_TABLE_DETAIL" table. 
 
Hope that makes sense, but let me know if you have any questions I can answer to help clarify.
 
Thanks for any help you can offer!
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 07 May 2009 at 7:20am
 SELECT "PRT_CURRENT__TIME"."Units",

"PRT_CURRENT__TIME"."Job",

"PRT_CURRENT__TIME"."Extra",

"PRT_CURRENT__TIME"."JC_Cost_Code",

"PRT_CURRENT__TIME"."Date",

"PRT_CURRENT__TIME"."Pay_Type", "PRM_MASTER__EMPLOYEE"."Employee_Name", "PRM_MASTER__EMPLOYEE"."Department", CASE WHEN ISNULL("CNC_ACTIVE__CONTRACT_ITEM"."Rate_Table_Labor",'')='' THEN 'EMES' ELSE "CNC_ACTIVE__CONTRACT_ITEM"."Rate_Table_Labor" END AS "Rate_Table_Labor" , "PRT_CURRENT__TIME"."JC_Category", "BLS_STANDARD__RATE_TABLE_DETAIL"."Unit_Price"
 FROM  

(("PRT_CURRENT__TIME" "PRT_CURRENT__TIME" INNER JOIN "CNC_ACTIVE__CONTRACT_ITEM" "CNC_ACTIVE__CONTRACT_ITEM" ON ("PRT_CURRENT__TIME"."Job"="CNC_ACTIVE__CONTRACT_ITEM"."Job") AND ("PRT_CURRENT__TIME"."Extra"="CNC_ACTIVE__CONTRACT_ITEM"."Extra")) INNER JOIN "PRM_MASTER__EMPLOYEE" "PRM_MASTER__EMPLOYEE" ON "PRT_CURRENT__TIME"."Employee"="PRM_MASTER__EMPLOYEE"."Employee") INNER JOIN "BLS_STANDARD__RATE_TABLE_DETAIL" "BLS_STANDARD__RATE_TABLE_DETAIL" ON ("PRT_CURRENT__TIME"."JC_Category"="BLS_STANDARD__RATE_TABLE_DETAIL"."Category") AND ("CNC_ACTIVE__CONTRACT_ITEM"."Rate_Table_Labor"="BLS_STANDARD__RATE_TABLE_DETAIL"."Rate_Table")
 WHERE   NOT ("PRT_CURRENT__TIME"."Pay_Type"='Accrual' OR "PRT_CURRENT__TIME"."Pay_Type"='Other') AND ("PRT_CURRENT__TIME"."Date">={d '2009-04-05'} AND "PRT_CURRENT__TIME"."Date"<={d '2009-04-11'}) AND "PRT_CURRENT__TIME"."Job" LIKE '__-______-__'

give this a try.  it should replace the nulls and blanks in the initial select, then life should be easier...
 
HTH
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