The reference field is showing ‘null null’ instead of the actual value
Observed behavior
The referenced column shows “null null” as a value
Expected behavior
The referenced column should show the actual value.
Context
I have a Users table with fields first_name and last_name. I have created a calculated fields called full_name (first_name + last_name). The referenced field for Users table is set as full_name.
There is another table called Users Emails, that stores the foreign key of the Users table. But in the Users column, the value for all the records is shown as “null null” (which is actually first_name and last_name). The strange part is if I click on this “null null”, I am redirected to the correct user details page and when I come back to this listing page (without refreshing anything), I can see the actual full name of the user.
Organization name: Project-V-Org
Project name: Project-V-Admin-Panel
Environment name: Production
Database type: MongoDB
Recent changes made on your end if any: NA
@Nicolas.M Could you please help me with this bug?
Hello,
I don’t reproduce on my side.
How long have you had this issue?
Could you share your calculated field source code please?
Could you check your network requests and check if there are a “null null” values?
Alban
How long have you had this issue?
I developed this about a month ago and I am facing this issue since the start.
3. Could you share your calculated field source code please?
collection.addField('full_name', {
// Create calculated field by concatenating two fields
columnType: 'String',
dependencies: ['profile@@@firstName', 'profile@@@lastName'],
getValues: (records, context) => {
return records.map(r => `${r['profile@@@firstName']} ${r['profile@@@lastName']}`);
}
});
Could you check your network requests and check if there are a “null null” values?
It’s null in network calls. I have attached the screenshot below. The first object is from “data” array and then starts the included array.
Could you please also focus on the fact that if I click on this “null null”, I am redirected to the correct user details page and when I come back to this listing page (without refreshing anything), I can see the actual full name of the user.
I have also tried changing the reference field to first_name (not a calculated field), still the issue I mentioned in the first point is not resolved. The only difference it made was instead of null, it displayed ID of the record which was replaced by the actual value later after I visited the user details.
I have also checked the other tables where users table is referenced, and the full_name is shown correctly
Forest admin schema file also shows correct relationship between Users and Emails table
I understand that you’re creating this field from a relationship, so you should include the complete path to the attribute you’re refering to: user:<attribute_name>
collection.addField('full_name', {
// Create calculated field by concatenating two fields
columnType: 'String',
dependencies: ['user:profile@@@firstName', 'user:profile@@@lastName'],
getValues: (records, context) => {
return records.map(r => `${r['user:profile@@@firstName']} ${r['user.profile@@@lastName']}`);
}
});
I don’t think that is the issue because full_name field appears fine in the Users table.
As I mentioned earlier, if I access the user record from Emails table and come back to the Emails table, full_name appears fine