What happens if lookup fails to find corresponding key value - Connect_CDC - connect_cdc_mimix_share - Latest

Connect CDC Advanced User Guide

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (MIMIX Share)
Version
Latest
Language
English
Product name
Connect CDC
Title
Connect CDC Advanced User Guide
Copyright
2024
First publish date
2003
Last edition
2024-07-19
Last publish date
2024-07-19T23:30:25.334335

If the lookup fails to find the corresponding key value, a question mark is returned. If you require a different datatype, such as date, decimal, or integer, you must expand the expression to accommodate this.

The following shows an example of how to return a default date if one is not found:

begin returns char;
   if ( LookupDatabaseTable('qatest.dbo.ORD', 'ORDER_ID', 'ORDER_DATE',  tostring("ORDERID") ) == '?')
        return '1900-01-01 01:01:01.000';
   else
       return LookupDatabaseTable('qatest.dbo.ORD', 'ORDER_ID', 'ORDER_DATE', tostring("ORDERID") );
end;

The following shows an example of how to return a decimal value when the lookup row is not found.

begin returns decimal;
   if ( LookupDatabaseTable('qatest.dbo.ORD', 'ORDER_ID', 'COST',  tostring("ORDERID") ) == '?')
       return 999.99;
   else
        return todecimal( LookupDatabaseTable('qatest.dbo.ORD', 'ORDER_ID', 'COST', tostring("ORDERID") ));
end;