Batch numbering #161
Unanswered
techieAgnostic
asked this question in
Q&A
Replies: 1 comment
-
Update: I ended up using a FixedRule for this, which isnt a problem as the ordering is irrelevent, as long as each line gets given a unique value |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a stored relation that contains an identifier column, and I would like to be able to sequentially increment that number while im adding new rows to the stored relation.
If every row in the batch needs the same identifier, then I can do that as follows:
However I would like to be able to handle multiple items in a batch, and for each one generate some number of rows, with each set of rows given its own id.
For example, given the input list
[ "X", "Y", "Z" ]
, and assuming the last_id contains2
, I want to recieve the rows:I'm aware that I could generate the latter two columns with a cartesian join as such:
But Im unsure how to do the first column.
I believe I could use %loop to repeatedly run the initial script on each part of the batch, however that feels not idiomatic as it would be repeatedly figuring out the maximum id for each iteration. This would also allow me to generate different rows per input, rather than solely using the cartesian product.
Is there a nicer way to do this?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions