Why is this formula working for one table but not the other?

I am trying to combine rows from two tables into one depending if they have values present in either column’s
Table ID: “Macro”
$Alert_Expiry

$TD_expected_Date

Table ID: “Watchlist_Tickers2”
$Alert_Expiry

$Potential_Entry_Date

It works and parses the appropriate rows from “Watchlist_Tickers2” but fails to parse from the table “Macro“

I have checked that the column and table ID’s are spelt correctly and I have tried just parsing “Macro“ on its own.

I am new too Grist and python so I don’t know where to start debugging. Any suggestions?

if $Source_Table == 'Watchlist Tickers':
    return Watchlist_Tickers2.lookupOne(id=$id).Potential_Entry_Date or Watchlist_Tickers2.lookupOne(id=$id).Alert_Expiry
elif $Source_Table == 'Macro':
    return Macro.lookupOne(id=$id).TD_expected_Date or Macro.lookupOne(id=$id).Alert_Expiry
else:
    return None

I don’t see anything wrong with your formula. In what way does it fail? I’d guess that most likely the actual data in the cells is somehow different between the two tables.

Ok so I have got successfully parsing from both tables now by again putting the if statement regarding table “Macro“ first. Not sure what I did wrong before which is frustrating haha. Sorry, I don’t like wasting helpful users time. Then through typing out the next and last issue here, i was going to ask for help with, the obvious became clear and I solved it to. Thanks