Skip to content

DB Row Exists ​

DB Row Exists block on the canvas

The DB Row Exists block looks up one record. If one matches, the flow continues on Success with that record. If none matches, it continues on Failure with the data it received.

When to use it ​

  • Check for a duplicate before you insert, like "is this email already registered?".
  • Return a 404 when a record doesn't exist, and carry on with the record when it does.
  • Don't use it to load a record and keep going either way. DB Get Single returns null on a miss and keeps one path.
  • Don't use it for lists. Use DB Get All or DB Count.

Inputs ​

The same fields as DB Get Single:

FieldRequiredDefaultWhat it does
ConnectionYesnoneThe database integration to use.
Table NameYesnoneThe table (or collection) to look in.
ConditionsNonone (any record)Rules that find the record, see DB Conditions.
JoinsNononeOther tables to combine, SQL only. See DB Joins.
ColumnsNoevery columnWhich columns the Success record holds.
Save output to variableNooffStore the record in outputs.<name>, see below.

Outputs ​

HandleWhen it is usedWhat the next block receives
Success (right)A record matches the conditions.The record itself, in the same shape DB Get Single returns.
Failure (right)No record matches.Whatever came into the block, unchanged.

Save output to variable ​

When Save output is on, the matching record is saved on the Success path. On the Failure path the variable is set to null, so it never holds a record from an earlier run of the block (for example, in a loop).

Example ​

Stop a sign-up when the email is already taken. The previous block output { "email": "[email protected]" }.

FieldValue
Connectionmain-db
Table Nameusers
Conditionsemail = js:input.email
  • Success means the email exists. Connect a Response with code 409.
  • Failure means it is free. Connect a DB Insert that receives the original { "email": ... } input.

How it behaves ​

  • A miss is not an error. The Failure path is a normal result, and the Error Handler does not run for it.
  • No conditions matches any record. The editor shows a warning when that happens.
  • Database errors (bad connection, missing table) are real errors. They go to the Error Handler, not to Failure.
  • It is like a Get Single plus an If. Use this block instead of DB Get Single followed by If Condition.

Released under the Apache License 2.0. Enterprise features are under the Fluxify Enterprise Edition License.