Quick overview This workflow demonstrates the n8n KeyValue community node by using a counter to run one-time initialization logic per workflow, storing a per-day execution flag to allow the main logic only once per day, and showcasing basic directory, record, and counter operations. How it works Starts when you manually execute the workflow. Reads a KeyValue counter named after the current n8n workflow ID and runs a one-time “first execution” branch only when the counter does not yet exist. Sets the workflow-ID counter in KeyValue to mark that the one-time initialization logic has been executed. Reads a KeyValue record (keyed by workflow ID) from the businessprocess directory and compares its stored date with today’s date. If today’s date is already stored, it stops in a “logic already executed” branch; otherwise it runs the main logic branch. Writes today’s date back to KeyValue (businessprocess directory) to enforce “run once per day” behavior on subsequent executions. Setup Install the KeyValue community node (n8n-nodes-keyvalue) in n8n under Settings → Community nodes.
Tags
Related workflows
See all General Automation→Calculate profit margin and markup with interactive web forms
Quick Overview This workflow exposes an n8n Form that calculates a product’s selling price from cost, tax, and marketplace fees using either a target profit margin or a target markup, then displays the resulting price, profit, margin, and markup (or a validation error) and lets users return to the form. How it works Receives an n8n Form submission with product cost, tax percentage, fee percentage, a desired value, and a chosen calculation method (Profit Margin or Markup). Validates that product cost is greater than 0 and that tax and fee percentages are 0 or higher, otherwise shows an error result page. Routes the request based on the selected method (Profit Margin vs Markup). For Profit Margin, verifies that tax + fee + desired margin is less than 100%, calculates selling price and profit, and shows the results page. For Markup, verifies that the markup is 0% or higher, calculates selling price, profit, and the resulting profit margin, and shows the results page. After any results or error page, redirects the user back to the initial form using the configured form URL. Setup Activate the workflow and open the Form Trigger node to copy its Production URL. Paste that Production URL
Using the Merge Node - Merge by Key
This is an example of how you can make Merge by Key work. The “Data 1” and “Data 2” nodes simply provide mock data. You can replace them with your own data sources. Then the “Convert Data” nodes are important. They make sure that the different array items are actually different items in n8n. After that, you have then the merge with the merged data.
Write JSON to Disk (Binary)
The “Write Binary File” expects binary data. The JSON data is, however, JSON ;) There should really be a node that allows moving data around between both of them. For now, it can be done with a Function-Node. At least till a proper one is in place. The first node is example data, wich you can customize or replace. The second node named “Make Binary” is the important one with the custom code which makes the data binary and writes it to the correct location.