Return the record to the table from another table to reorder the numbering!

Good day TB Community.

I would like to know if this is possible. Since I don’t really know what to do with auto numbering.

Auto Increment

It really gives me literal headache.

I hope someone can give me idea on how to do this in TB.

Is there a way I can return the values from table blue to red.

Example: Table blue is connected to table red. If I delete a record in table red. there will be a trigger like action button that will copy the column on the table blue so that that table red numbering will be in order. I hope someone can help me.

Thank you

Hey @edison

I’d have to spend some time thinking about this but I’m not this would be possible and/or practical. Let’s say you have 500 records and delete record #5 — you’d then have to and update 495 records with new number values.

In addition, and arguably most important, Auto Increment values can not be modified so this would have to be done using a number field.

Thank you so much for the reply @tim.young

Noted on the update process.

If Auto Increment values cannot be modified. Is there a way I can make an equation or formula connected to the upper or lower row of the table?

It’s been days since I am thinking of these. I hope you can give me idea or if it is not possible.

THank you in advance.

As far as equations are concerned, the upper or lower record will always be +/- 1. So you could create an equation that takes the records auto increment and adds or subtracts 1 to get the previous records auto ID or the next records auto ID

thank you. I will try that.

@tim.young I am so sorry. I hope you can help me. I spend hours thinking of it. Thank you.

I have an idea. It’s not pretty, but I think it will work (for small scale apps at least).

The basic problem, as I see it, is that a table of data may look like a spreadsheet but it is crucially different in that each row of data has a hard time getting any data from the row above it or below it - each row is separate. To solve this sorting problem you’d like to know the sequence number of the row above and can’t get it.

So my very messy solution is to use the only function that spans rows - Rollup.

First of all create a new table called ‘Sequence’
Add a field called ‘WorkingDB’.

Then in the WorkingDB table create a 1:1 connection to the Sequence Table. And create a rule so that each time a new WorkingDB record is created its adds a new connection to the record in the Sequence table. (There is a new Pipe that does this - called ‘Plucker’).

Now you have two tables.

Your original table, and a Sequence table with a record that is is connected to by all (existing) WorkingDB records.

Now you can use Rollup. Add a Rollup field to the Sequence table, and concatenate all your IndexPositions from the WorkingDB table.

You will end up with a long string of all your current index positions, separated by a delimiter character - probably a comma. (You can see why its not going to scale to big tables)

Then, in your WorkingDb table you can now add a Text Formula field and pull in that Rollup (yes that’s a long string added to every record !)

And then add a formula field to LOCATE the line Index within that string. This will give you the startinng character position of the line Index, but this not the new Index number - not yet.

Then you need to us LEFT to select only the characters before your string. What you want to do with this string is to count the number of delimiter characters in the string, but there is no Count function, so you will need to REPLACE all other characters with blank “” until you are just left with a string of delimiter characters. Now you can use LEN to count the number of delimiters.

And your real Index will be that count + 1.

And if records are deleted in the listing, it will respond.

Messy, probably too complex. But would work.

1 Like

I will try this. Thank you very much. @mtif

Hi @edison -

Can you give some background on what you attempting to accomplish by renumbering? Understanding the logic behind your desire would help.

Thanks,
Adam

Thank you for paying attention to my concern @SafetyUniversity I really appreciate it.

My goal is to create a sets of questions with a proper and in order numbering.

This is a sets of question under a subject. I can create a number in order 1,2,3,4,5… , but if for example I want to delete a question in between the numbers, let’s say the number 3, the order number will be ruin. :frowning:

If there is a way I can delete the number 3 and the next numbers which is 4 and 5 will automatically be 3 and 4.

This is what I want to achieve.

Thank you in advance.

1 Like

Just exploring here…are numbers important and if so, why? Your desire would be extremely easy if the numbers were not required.

Off the top of my head, developing a custom component would probably be the easiest way to accomplish the numbered order of questions.

@kruizf201 might be able to help as he’s helped me at a reasonable rate for custom JS and components.

Thoughts?

Thank you sir.

Yes, the order number is very important because it is not a random question. It is more on personal questions and should be in particular order. :slight_smile:

Appreciate it so much sir.

Hi @mtif,

I want to follow this, but I am not so technical and good at this. Could you please if its ok to make a short video on how to do this.

I hope you consider. please… Thank you!

Hey @edison, I’ve been brainstorming this, and I think I found a solution. It requires a bit of code, but I hope it’ll work for you.

Click here to copy the demo app I use in the video to your account.

1 Like

Hi @Chem,

Thank you very much for this. This is exactly what I am looking for. You made me cry in happiness.

More power to Tadabase!!!

Thank you :slight_smile: :slight_smile: :slight_smile:

1 Like

Hi @Chem

Just a concern. I cannot find the copy code on the Pipe.

No Copy Code

Thank you :slight_smile:

2 Likes

Thanks Chem

As ever I learn so much from seeing how you do it.

1 Like

@mtif @edison and anyone else who wants to use this feature, please reach out to support with your email and app ID, and we’ll be able to enable it for you.

Hi @Chem this works fine when creating a good orderly question but when I use the Duplicate Parent and child Pipe. It did not copy exactly what the order was.

Duplicate

In the red box. that was the re-ordered and perfect number created. in the blue box, that was the duplicate. Question Name One on the original is Order 1, while on the duplicate, it became Order 6. I try to make another column to copy it thinking that it will stay in order. but I failed.

Am I doing it wrong? if there is another way. Please help me. Thank you.

@edison I’m unsure exactly why, but I assume it has to do with the timing of the rollup updating and how quickly the duplicate pipe runs. An easy way to fix it is to have the script above run again, and it will quickly recount and update the order again.