Data Validation

With all the sites having their own character counts that are allowed, it would be nice to have a data validation (for character count) piece built into the branch. I am currently working on making it work with a openrouter question, as my preference is to code as little as possible. But, I would much rather it be a core mechanic, to not have to ask ai.

Curious what others think, and what they are doing to resolve?

The data validation if true, should exit the loop. If false, it should go back to the step again. I know there must be a way, but my brain is beginning to hurt. Is there a STOP function to the core pieces?

Perhaps that is the easiest way to make this work for data validation is a STOP.

There is a lower-code approach than using a Code piece for many tasks, which is our Javascript inline functions. These are Javascript expressions that can be placed between {{ }} and can be added in any input field.

For example, if you want to do a condition based on number of characters, this is how you can do it:

However, we don’t yet have something like “Exit the loop”, so you can use an empty branch to ignore that sequence of steps

1 Like

Yes, using that. However, in a loop/branch environment where if a FALSE is returned, I need it to loop the task, and if a true is returned, to exit the loop, to the next task.

export const code = async () => {
let shouldContinue = true;

while (shouldContinue) {
// Your code here to determine whether to continue or exit
// For example, you can use a function to calculate shouldContinue

shouldContinue = !yourConditionFunction(); // Call your condition function and invert the result


return true; // Return true when the condition is met

// Define your condition function elsewhere in your code
function yourConditionFunction() {
// Your logic to determine whether to continue or exit
// Return true to exit the loop, false to continue

Oh that’s more like a Goto function that takes you to a totally another step in the flow (not exist the loop per se). I think this will complicate how our flow designer and debugger work. Why don’t you move part of your flow to another flow and call it whenever necessary from any point in the other flows?

Is it possible to get a break or stop to the loop?

Calling up another flow doesn’t really resolve the data validation and/or the end of the loop issue.

Sorry to hijack the thread, my reply is slightly for selfish reasons and a little off topic to the OP’s comment.

I hope it’s allowed?

Firstly, I just wanted to say that I wish I had known this earlier! It may have helped me greatly with an example I was working on for someone else here in the community. Do you have any documentation on this? (Or at least the location on GitHub of where the inline functions etc. can be found?).

This is possible? I’m intrigued. How would you approach calling a flow from another flow?

Again, are there any examples or documentation on this?

Kind regards

On another note, I do agree this is a much needed feature, and the ability to restart the loop on certain conditions.

Perhaps not the flow as a whole, but I guess you could maybe put the loop directly after the trigger and just nest an insane amount of branches. But it doesn’t seem entirely practical in that way.

Yeah, I thought of the branches method, but it is not practical, and also less so without a duplicate feature. I’d prefer just a loop break, which is pretty standard in programming.

1 Like