Update by Value or Create

Update or create a database row by a value.

If you are unsure how to use Databases, we have a tutorial that goes over them here.

What does it do?

The Update by Value or Create block allows you to search for a row with a specified column value.

If a row is found, that row is updated with the second column value. If no row is found, a new row is created with bot columns set to the provided columns.

Example of Update by Value or Create Block


Inputs

Database

Provide the name of the database to use for this block.

The database must exist on the current bot.

Example: my_database

Search Column

The column to search for a row by.

Provide the name of a column in the selected database.

Make sure that the column exists in the selected database.

Example: my_column

Search Value

The value to search for in the Search Column. If a row is found, it will be updated with the value in the Update Column. If not found, a new row will be created with both columns set to the provided values.

Provide a value to look up in the selected database/column.

Example: Example value!

Search Column 2

Provide the name of a column in the selected database.

Make sure that the column exists in the selected database.

Example: my_column

Search Value 2

Provide a value to look up in the selected database/column.

Example: Example value!

Search Column 3

Provide the name of a column in the selected database.

Make sure that the column exists in the selected database.

Example: my_column

Search Value 3

Provide a value to look up in the selected database/column.

Example: Example value!

Search Column 4

Provide the name of a column in the selected database.

Make sure that the column exists in the selected database.

Example: my_column

Search Value 4

Provide a value to look up in the selected database/column.

Example: Example value!

Search Column 5

Provide the name of a column in the selected database.

Make sure that the column exists in the selected database.

Example: my_column

Search Value 5

Provide a value to look up in the selected database/column.

Example: Example value!

Update Column

The column to update if a row is found. If a row is not found, a new row will be created with both columns set to the provided values.

Provide the name of a column in the selected database to update.

Make sure that the column exists in the selected database.

Example: my_column

Update Value

Provide a value to update in the selected database/column.

Example: Example value!

Outputs

Row ID

The Row ID of either the updated row or created row.

Example: abcdef12-3456-7890-abcd-ef1234567890

Created At (Unix)

The Unix timestamp of when the row was created.

Example: 1731886315

Updated At (Unix)

The Unix timestamp of the last time the row was updated.

Example: 1731886315