I hope someone can give me some pointers here. I think Bubble may be exactly what I need, if I can get my head around how data is handled. I have many years SQL Server development experience and so DB design and concepts are very familiar. I am trying to equate what’s going on in Bubble with a traditional SQL database, which may be the wrong way to look it, but it’s my current frame of reference.
I am trying to collect some simple data (name, address etc). On my initial page I am collecting firstname and lastname and creating a thing called User. I understand that this the equivalent of a DB table. The data that I’m collecting will allow the user to create their record (Bill Smith for example), it then goes on to allow them to create multiple, child users. Obviously, to do this, I need to create a self join, so I am trying to create a PK for the User in the initial step. I’m not too concerned about what this ID is as the user rows will be uploaded to SQL via an API so I’ll generate the actual PK in the database anyway.
I create the user in the workflow when the user has enetered first/last name and I tried to create a random number by using the random string option.
However, when I look at the Data, I get a value of 10 for each user. This obviously creates a problem as my PK is not unique.
I also can’t seem to grasp how I should be referencing this user. When the parent record is created they will select the number of child records (1-4), so I want to create 1-4 child records related to this parent (using the UserID as the FK). I had originally used the built-in CurrentUser, but since I need to create multiple users I assumed I’d need my own Users table.
Specifically, I am trying to understand:
- How should I use to the randomgenerator to create a PK (or should I be doing this a different way entirely)?
- How do I read the data back in the workflow?
Can anyone point me in the right direction please?