Getting the perfect formula on your first try is rare, even for experienced builders! Auto generate is designed to work iteratively. You can refine your prompt and regenerate as many times as you need.
When to refine your prompt
You'll know you need to refine your prompt when:
The formula produces an error
The output is in the wrong format
The result is close, but not exactly what you need
The formula doesn't handle edge cases properly
Refinement is a normal part of the process. Each iteration helps you get closer to the result you want, and you'll learn more about how to write effective prompts along the way.
Adjust prompts based on results
Look at what the generated formula produced and think about how you can make your prompt more specific. Often, a small change in how you describe the requirement makes a big difference.
If the formula returned the wrong data type, specify the type in your prompt: "Return as a string" or "Return as an array of objects."
If the formula didn't handle null values, add that to your prompt: "If the field is null, return 'N/A' instead."
If the formula extracted the wrong part of the data, be more explicit about the path: "Get the email field from the first item in the users array."
🪄Tip
Test across different data scenarios
Once you have a formula that works with one event, test it with others. Look for events that represent different scenarios:
Events with all fields populated
Events with some fields missing or null
Events with empty arrays or objects
Events with unexpected data formats
This comprehensive testing helps you catch issues before your story runs in production. If the formula fails with certain events, refine your prompt to handle those cases.