Describe the problem/error/question
I’m retrieving some records from postgres. If there are found records, I want to process them and email them to an address. If nothing found, obviously no email.
I can’t find a way to conditional this as I can’t get the found count from the returned records in JSON.
Please share your workflow
const recordCount = items.length;
return [
{
json: {
recordCount: recordCount,
hasRecords: recordCount > 0
}
}
];
Now I can’t seem to provide a conditional on hasRecords being a boolean.
On a conditional (IF): {{ $json.hasRecords === true ? true : false }} is equal to ‘true’. Booleans won’t take that provided conditional, so I have to use the string comparator.
Information on your n8n setup
-
n8n version:
1.74.3 -
Database (default: SQLite):
postgresql 13 -
n8n EXECUTIONS_PROCESS setting (default: own, main):
Not sure what this means. -
Running n8n via (Docker, npm, n8n cloud, desktop app):
Hosted on linux, no docker. -
Operating system:
Almalinux 9