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

Connect CDC Advanced User Guide

Product type
Software
Portfolio
Integrate
Product family
Connect
Product
Connect > Connect CDC (MIMIX Share)
Version
5.8
Language
English
Product name
Connect CDC
Title
Connect CDC Advanced User Guide
Copyright
2023
First publish date
2003
ft:lastEdition
2023-09-27
ft:lastPublication
2023-09-27T18:12:55.651884

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;