i have try to get the excel sheet using xlsx-populate so i am trying to get the values from mailEvents collections so i can add or pass the value in the init Collection function.if i have solved this issue then my problem regarding excel is also solved.
in this problem i want to access the topHeader var in init collection.
here in arr2 there is the values in this form ['open','processed']
const completeReport = (startTime,endTime) => {
serverRef = db.collection("MailEvents");
let getDocs = serverRef
.where("timestamp", ">=", startTime)
.where("timestamp", "<=", endTime)
.get()
.then(querySnapshot => {
if (querySnapshot) {
let docs = querySnapshot.docs.map(doc => doc.data());
let arr1 = ["email", "reportName", "office"];
let arr2 = docs.map(a => a.event);
let topHeader = [...new Set(arr1.concat(arr2))];
}
});
let query = db.collection("inits");
let queryData = query
.where("report", "in", ["payroll", "footprints"])
.get()
.then(querySnapshot => {
if (querySnapshot) {
let docs = querySnapshot.docs.map(doc => doc.data());
console.log(topHeader)
}
});
}
so i want the output in this form
["email", "reportName", "office",'open','processed']
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…