I’m using the latest version of OpenRefine (3.7.1) on macOS Ventura with the latest version of Opera (97.0.4). Trying to use the cell.cross function like I did numerous times before. But this time I get an error message I am not used to: Error: “java.lang.NullPointerException”. What could it be? There is no syntax error. Names of project and columns have been doubled checked. I’ve tried everything I could think of, alas, to no avail.
Cell.cross not working: getting the following error message: Error: "java.lang.NullPointerException"
Could you reply with slightly more of the java stacktrace from your console log so we can see what part of OpenRefine is actually throwing a NullPointerException?
Thanks for replying. Could you point me to the consol log? I quoted the error message directly from the “Add a Column based on this column” window:
cross function will return an array of rows from the second project because it’s possible that the ID could appear multiple times. This means you have to process the response from
cross as an array - using either a control (General Refine Expression Language | OpenRefine) or function that will work with an array (GREL functions | OpenRefine)
I’d usually use the
forEach control which would mean using something like:
This is going to process each row returned, extract the value from the U5 column, and if there are multiple values join them together into a single value with a separator (the pipe character
| here but you can use whatever character/string of characters you like)
If this doesn’t help and you are still seeing errors, please post more information on your issue including:
- version of OpenRefine
- what do you see in the GREL preview if you just use
should work. Documentation needs to be fixed.
Thanks for reporting that.
What I said in the previous comment is not true. Both forms are correct!
@ostephens comment in GH explains it.
Thank you for the helping hand. While it did not solved my issue, I like this answer and I will keep it bookmarked. Actually, there are no duplicate of ID, but we did found a problem, e.i. there where a small number with letters instead of strings of numbers exclusively. It resulted in a problem while using Python, (we were trying to resolve the problem outside of OpenRefine). However, as much as I know, it should not be a problem in OpenRefine.
A friend who offered to help has been able to do the crossing between the tables without problem. For this reason, I am much inclined to believe it is a problem specific to a certain system configuration, a problem of software. This friend works on Windows and he might be using an older version of OpenRefine, while I’m on a Mac with the latest OS and latest version of the software.
I don’t know. I hope either to figure out the problem soon, or simply to see it vanish, as it is a function I use semi-frequently, and I need to use it on another dataset this very week.
Right now I use version 3.7.2.
cell.cross('corpus_alimentation_EN_complet','ID') will return the exact same message of error (Erreur: java.lang.NullPointerException).