API worflow on list of things - increasing serial number?

Hi! I have searched throughout the forum, but still haven’t managed to find the solution. The question is simple, but I don’t know if the answer also is…

I have managed to duplicate a list of things (illustrated in the pic below) with the parameter I want (car), but I can’t seem to figure out how to add +1 to the ID-number in the new table… I have a column in another table that counts number of cars which I use as a reference point but…

Anyone? :slight_smile:

What is the problem? Your ID numbers on the new table are in order right? Going from 1 to 2 ( ie 1+1 )…don’t you already have the serial numbers getting added correctly?

Or after re-reading your post are you trying to get the ID of Car Opel to be 2 in the new table, and so Ford would be 3 and Rolls Royce 4 and BMW 5 and Mazda 6?

I am a bit confused about your goal and what you are having difficulties with because I am not sure why you would want to duplicate a list of cars and change the ID…your ID of Opel ( a Make of a car ) should always be 1 to represent that Make of a car…then you can have relationships to another data type of Model ( which for BMW would be M3 or 7series…sorry I don’t know the models of the other car Makes…just how I roll :stuck_out_tongue_winking_eye:)

Then you could have an ID for each Model as well…but really you shouldn’t use numbers you should use random generated strings or use a SKU and Key system.

Keys are short sets of letters to represent a product like R for Red or LRG for Large…whatever you want them to be.

SKUs are strings created by a set of keys getting added together like R-LRG…for Red Large

In car example could be BMW-7S for BMW 7 Series.

These can be very beneficial for far reasons.

However, if you are trying to change Opel from table 1 with ID of 2 for the duplicated list…you need to do a math formula on the ID ( make sure it is a number data field ) and reference the ID and add 1

ID = Original List ID+1

Can use the list element as a source: Repeating group 1 list of cars

Thanks for your reply, boston85719! :slight_smile: I think I explained myself a little bit short earlier… The illustrating table in my initial post is the correct outcome of my new table. I manage to iterate through the original table and duplicate the cars, but I have difficulties with adding any “new” or variating info in each duplicate (only copied info from the origianl is correct).

I tried to set the ID like this to get the next “serial number” correct:

ID = Current user’s Company’s number_of_cars + 1

The problem is, that is doesn’t add +1 per duplicated car, so ALL of the cars in the new table get ID = 6.

Br, Endre

If you show screen shots of how you are making the copy or open your editor so I could look at it and see how you are doing things I might be able to help you figure out what is the issue.

Sure! This is how I “wish” the workflow would generate the duplicate from the original object, but ends up with just adding one number for all objects…

seems like you are creating a thing, but it should be a list of things

The result is a list of things, but each object which I’m duplicating is a single thing :slight_smile: I think this is the correct approach, but as mentiond… I’m struggling to add a new and increasing value in on of the columns… It seems that I only can add already existing values…

BR, Endre

my original suggestion should work:

ID = current car ID + 1

If you are setting the data type to number

But I can’t really help you unless I saw how you set everything up, so if you want to open your editor for me to view I will take a look

@endrefyl, what’s happening with doing this workflow on a list is that Bubble is counting the number of cars only once before performing the workflow and then passing a static number to every item in the list (which is of course 6).

There are several ways to do this. Try searching ‘recursive workflows’ in the forum here. Recursive workflows are your friend :slight_smile:

If it’s easier or you simply want to use the workflow on a list, simply count the items in the list you are running the workflow on and then pass the ID as ID = This car’s ID + this lists:count.

In your example above, this would tell Bubble to take the total items in the list you are duplicating and add it to the ID # of each car.

So, total list count = 5

Opel 1 ID = 1
Opel 2 ID = 1+5 (6)

Ford 1 ID = 2
Ford 2 ID = 2+5 (7)

Rolls Royce 1 ID = 3
Rolls Royce 2 ID = 3+5 (8)

BMW 1 ID = 4
BMW 2 ID = 4+5 (9)

Mazda 1 ID = 5
Mazda 2 ID = 5+5 (10)

1 Like

wow! Thank you so much, Eli! That solved the issue :smiley: Have a excellent weekend!