Loop Body wired incorrectly - can't figure out the way around it...

Situation:

I have an issue with my DB Writer node because some of the date fields in my dataset are in the datetime2 format (which allows for dates such as 0001-01-01) which isn’t supported by my SQL server.

I have created a piece of workflow that takes all the datetime columns and where it is less than the permitted value, it defaults it to 1900-01-01.

Issue:

Although the loop does the job in principle, the issue is I don’t actually want to pass any of the output of the variable loop end node to anything, I just want to take the result after the expressions and carry on with it. This is obviously not allowed, but I can’t fathom how else to do it.

Please help

image

Many thanks,
Charlie

Hi Charlie,

it’s difficult to say without knowing what the loop exactly does. But if you don’t want to collect the variables at the end, you could use a basic Loop End instead (between Column Expression and Column Filter), which would automatically stop after all the Variables from the Table Row To Variable Loop Start have been processed.
Alternatively, you could also try the Rule Engine node, but I don’t know if this can be used with dates.

Best regards,
Daniela

The loop takes a column, checks the datetime, changes it if required, then loops back to another datetime column and does the same, thus making sure all datetime2 fields are in a comparable format with datetime

Try connecting the Variable Loop End node to the final node in the workflow, like the DB Writer node.

Pretty sure that wouldn’t work as that would mean the DB Writer would run for each loop, whereas I need it to loop before the DB Writer, and then write the overall resulting table.

If it is based on columns you can use Column List Loop Start, iterate through you date columns, do your transformations and close the loop and then continue your flow.
br

1 Like

Hi @knightyboy , any reason why you are using the Variable Loop End? Like what’s supposed to happen? Do you expect the Column Expressions to run as many times as the loop is supposed to run? What output are you expecting the Column Expressions to do, and what cumulative output are you expecting? That Variable Loop End can’t handle the various output that Column Expressions will produce.

A Generic Loop End, or a Loop End (Column Append) would probably work better, but it depends on what you are trying to do.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.