Fri Aug 19, 2022 4:53 pm
Login Register Lost Password? Contact Us

Please Note: The HPCC Systems forums are moving to Stack Overflow. We invite you to post your questions on Stack Overflow utilizing the tag hpcc-ecl (https://stackoverflow.com/search?tab=newest&q=hpcc-ecl). This legacy forum will be active and monitored during our transition to Stack Overflow but will become read only beginning September 1, 2022.



Truth, False, or Blank

Questions around writing code and queries

Tue Feb 18, 2020 4:53 pm Change Time Zone

Hi everyone,

I was wondering how can I compare two files and check for matching records and flag each result accordingly with True, False, or Blank.

So for True or False I can easily use:
Code: Select all
self.fname_match := if(Le.fname = Ri.fname, 'T', 'F');


But how can I compare to get True, False or Blank when there is an empty string?
mo0926
 
Posts: 18
Joined: Thu Jan 09, 2020 3:57 pm

Tue Feb 18, 2020 5:02 pm Change Time Zone

mauricexxvi ,

You could do it this way:
Code: Select all
self.fname_match := MAP(Le.fname = '' AND Ri.fname = '' => '',
                        Le.fname = Ri.fname => 'T',
                        'F');

So this code reads: IF the names are blank, return blank, ELSE IF the names match return 'T' ELSE return 'F'.

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1619
Joined: Wed Oct 26, 2011 7:40 pm

Mon Sep 21, 2020 8:46 pm Change Time Zone

Thank you!
mo0926
 
Posts: 18
Joined: Thu Jan 09, 2020 3:57 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron