Null Foreign Key Query?


#1

Am I crazy? Probably.

I am just trying to add a filter where a foreign key of the table being queried is NULL with the UI (non-SQL).

Table1

  • id
  • name
  • table2_id

Table2

  • id
  • name

In SQL form it would be:

SELECT * FROM table1 where table2_id IS NULL;

I can’t seem to do it because the FKs get hidden from Table1’s filterable fields and adding a check for empty on Table2’s id field returns the error “java.lang.NullPointerException”

Am I missing some very obvious method to do it?

Thanks! And please shame me if I missed it. :smile:


#2

This should work fine. You would select Table1 when you start a new question, then add a filter. In the filter picker you should click on the name for Table2 to expand its columns, then click on Table2.id and choose the not empty filter option and apply the filter.

Then run the query and you should be g2g.


#3

Right, that’s what I did, but I end up with a “There was a problem with your question…
java.lang.NullPointerException” error. I do use GUIDs so that may or may not be why It’s hitting the NullPointerException? Happens for both “empty” or “not empty.”


#4

This is still happening.

I have a calendar table, and a client table.

Calendar has client_id, and I linked it to Client on the metadata configuration.

I tried setting the relationship field’s Display Value to the name of the client.

When I try to list the data, I get this NullPointerException.