I have tried different variable names, messing with $post_id, returning a hard-coded string but no matter what I do the relationship field always shows null. The number of custom post displayed is correct, that is how I know that the relationship is querying the right post type.
I thought the problem might be that the post type I’m looking up doesn’t have a title, but I tried with another post type which has it and it doesn’t work either.
I’m probably missing something rather simple. Any help is much appreciated.
Since it’s showing nothing it does seem to be working. It appears from your description that the fields have no values. I would double check the field names. Also I would look at if these fields are sub fields of another field.