mattsch
mattsch2y ago

Thanks for this So not possible to have

Thanks for this. So not possible to have it visible in the table grid view?
4 Replies
Bhavya
Bhavya2y ago
@mattsch, not currently. But you can always use a derivative field to extract the Document-Id and store it as a separate column, if that's useful?
Bhavya
Bhavya2y ago
@mattsch Here's how you can do it: Listener Fields: Pick any Output Field Type: ID Derivative Script:
const derivative:Derivative = async ({row,ref,db,storage,auth,logging})=>{
// WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY
logging.log("derivative started")
ref.get().then((doc) => {
if (doc.exists) {
return(doc.id); // This will log the document ID
} else {
return('No such document!');
}
}).catch((error) => {
return(error);
});
// WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY
}
const derivative:Derivative = async ({row,ref,db,storage,auth,logging})=>{
// WRITE YOUR CODE ONLY BELOW THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY
logging.log("derivative started")
ref.get().then((doc) => {
if (doc.exists) {
return(doc.id); // This will log the document ID
} else {
return('No such document!');
}
}).catch((error) => {
return(error);
});
// WRITE YOUR CODE ONLY ABOVE THIS LINE. DO NOT WRITE CODE/COMMENTS OUTSIDE THE FUNCTION BODY
}
No description
mattsch
mattsch2y ago
Thanks @Bhavya ✨ . Could be nice to have an option on the table settings to show/hide the record ID as a column. Maybe once I find time/headspace, it could be a good first PR
Bhavya
Bhavya2y ago
Definitely, looking forward to your PR! 🙂