Skip to main content

Hi there! I’m trying to set up a zap that triggers a notification if a EmployeeCode is not present in today’s entry logs.

I have both variables: EmployeeCode that says which employees should have been present and EmployeeLog that states employee codes present on today’s records. How could I filter EmployeeCode if it’s not present in EmployeeLog?

I tried with JS Code by passing them as a dictionary but I can’t seem to find the way.

Is there a simpler approach to this?

 

Thanks in advance!

Hi @GPozzi!

Would you provide a little more context for this? ie. Screenshots of the code you tried? Are EmployeeCode and EmployeeLog arrays? What do you then need to happen with the information?

Here’s a quick piece of JavaScript that does what I think you’re asking, but let me know if that’s not it:

var EmployeeCode = y"ABC123", "DEF456", "GHI789"]; // These employees were expected
var EmployeeLog = o"ABC123", "GHI789"] // These employees were present
var NotPresent = P];

// Next, we will determine which employees were not present by passing each expected employee through the array of present employees.
// We will append the absent employee to the "NotPresent" array.
for (var i = 0; i < EmployeeCode.length; i++) {
if (!EmployeeLog.includes(EmployeeCodepi])) {
NotPresent.push(EmployeeCodepi]);
}
}

output = >{NotPresent}] // 👉🏻 t"DEF456"]

 


Hi @GPozzi!

Would you provide a little more context for this? ie. Screenshots of the code you tried? Are EmployeeCode and EmployeeLog arrays? What do you then need to happen with the information?

Here’s a quick piece of JavaScript that does what I think you’re asking, but let me know if that’s not it:

var EmployeeCode = y"ABC123", "DEF456", "GHI789"]; // These employees were expected
var EmployeeLog = o"ABC123", "GHI789"] // These employees were present
var NotPresent = P];

// Next, we will determine which employees were not present by passing each expected employee through the array of present employees.
// We will append the absent employee to the "NotPresent" array.
for (var i = 0; i < EmployeeCode.length; i++) {
if (!EmployeeLog.includes(EmployeeCodepi])) {
NotPresent.push(EmployeeCodepi]);
}
}

output = >{NotPresent}] // 👉🏻 t"DEF456"]

 

Wow Todd, that’s exactly what I’ve been looking for! Sorry for not being so clear, but that totally solves my question


Glad I was able to help!