Skip to main content
Question

Case Statement in Lobby Data Source Designer is not working


Forum|alt.badge.img+1

Hi all,

This following case statement is executing successfully in quick reports but it will not work in data source designer. When I preview the data source, it loads for awhile like it wants to run but then it fails.

Any ideas?

 

(SELECT CASE WHEN INVENTORY_TRANSACTION_HIST.TRANSACTION_CODE='OESHIP' AND PART_CATALOG_CFV.PART_MAIN_GROUP='DOMESTIC FG' THEN  INVENTORY_TRANSACTION_HIST.QUANTITY * PART_CATALOG_CFV.CF$_PROOF_GALLONS WHEN INVENTORY_TRANSACTION_HIST.TRANSACTION_CODE='OESHIP' AND PART_CATALOG_CFV.PART_MAIN_GROUP='EXPORT FG' THEN INVENTORY_TRANSACTION_HIST.QUANTITY * PART_CATALOG_CFV.CF$_PROOF_GALLONS WHEN INVENTORY_TRANSACTION_HIST.TRANSACTION_CODE='SHIPTRAN' AND PART_CATALOG_CFV.PART_MAIN_GROUP='DOMESTIC FG' THEN INVENTORY_TRANSACTION_HIST.QUANTITY * PART_CATALOG_CFV.CF$_PROOF_GALLONS WHEN INVENTORY_TRANSACTION_HIST.TRANSACTION_CODE='SHIPTRAN' AND PART_CATALOG_CFV.PART_MAIN_GROUP='EXPORT FG' THEN 0 END FROM INVENTORY_TRANSACTION_HIST, PART_CATALOG_CFV WHERE INVENTORY_TRANSACTION_HIST.PART_NO=PART_CATALOG_CFV.PART_NO)

4 replies

Forum|alt.badge.img+9
  • Hero (Customer)
  • 78 replies
  • March 17, 2023

Hi,

Does it run as the same user in quick report mode as it does in the lobby?

What error does it actually fail with?


Forum|alt.badge.img+1

Thanks for the reply. It does run as the same user in quick report mode as it does in lobby data source designer. I don’t get an exact error message. It just says to make sure my columns are configured correctly


Forum|alt.badge.img+9
  • Hero (Customer)
  • 78 replies
  • March 17, 2023

I’ll hazard a quick guess - the case statements would work as straight SQL because the column name is worked out on the fly, but the lobby designer may actually need a output field name to work.  Try changing the case statement so that you specify a column name for the output data e.g.

 

( SELECT
     CASE
         WHEN inventory_transaction_hist.transaction_code = 'OESHIP'
            AND part_catalog_cfv.part_main_group = 'DOMESTIC FG' THEN inventory_transaction_hist.quantity * part_catalog_cfv.cf$_proof_gallons
         WHEN inventory_transaction_hist.transaction_code = 'OESHIP'
            AND part_catalog_cfv.part_main_group = 'EXPORT FG' THEN inventory_transaction_hist.quantity * part_catalog_cfv.cf$_proof_gallons
         WHEN inventory_transaction_hist.transaction_code = 'SHIPTRAN'
            AND part_catalog_cfv.part_main_group = 'DOMESTIC FG' THEN inventory_transaction_hist.quantity * part_catalog_cfv.cf$_proof_gallons
         WHEN inventory_transaction_hist.transaction_code = 'SHIPTRAN'
            AND part_catalog_cfv.part_main_group = 'EXPORT FG' THEN 0
     END as value
   FROM
     inventory_transaction_hist,
     part_catalog_cfv
  WHERE
     inventory_transaction_hist.part_no = part_catalog_cfv.part_no
 )

here I’ve taken your code and specified a field name of “value”.


Forum|alt.badge.img+1

I thought the same thing at first as well. In the data source designer you define the column name beside the select statements. Thanks again!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings