Adding datas to different types

Hi guys, I’m a complete newbie to this and I’ve been trying to get through this for almost 2h now so I decided to give up:

I’m making a database for a real estate so basically what I do is create accounts for the owners and later I register their properties.

What I’m struggling to do is make those 2 lists be crossed over so that I can later list properties from the same owner for example

Everytime I try to do so by adding it into lists, I can’t complete the code because it keeps on getting me to add and “or” or “and” when I think it’s finished already :frowning:

Long story short here’s how I want to make it:
I add a property owner: John Adams

Then I add 2 properties while searching for the owner of the properties:
Avenue 1
Avenue 2

When I finish it, I want both adresses to be added to the same owner, but what I’m getting right now is 2 different entries. When I try it with texts I can finish the code (and it won’t work as intended) but I can’t finish it when I try it with lists (it keeps on asking me to add commands), so any help is welcome.

Kind Regards,
Rodrigo

Hi there, @roclg… what you have described (if I understand it correctly) sounds pretty straightforward. I’m guessing you have a data type for properties, so let’s call that Property. Each property that is created in your app should be saved as a separate thing in the Property data type. Then, there are a number of ways you can link each property to an owner. One of those ways is to have a field on the Property data type that is tied to the data type where you are saving the property owners. If the property owners are the users of your app, then you could have field called owner in the Property data type, and the field type of the owner field would be User (meaning that the field is tied to your User data type).

With the above setup in place, you would want to save the user who is the owner of a property in the owner field when a new thing is created in the Property data type. At that point, getting all of an owner’s properties is as simple as doing a search for properties where the owner is a specific owner (perhaps the current user).

Another way you could go is to have a list field called properties on the User data type, and you could store a list of an owner’s properties in that field. So, any time a new property is created, you would add the property to the owner’s (user’s) properties field, and then you would have easy access to all of the properties for a particular owner (user) by using Current user's properties.

I hope this information is helpful. If you need more help, please provide screenshots of what you are doing so someone can give you an answer that is more directly related to your situation.

Best…
Mike

Hey, thanks a lot for answering!

I’m trying the first option, where the data is linked but I’m doing something wrong and I have no idea of what it is.

So basically I created 2 data types: Imóveis (properties) and Proprietários (property owners) and inside them I created multiple text fields and inside imóveis I set a list field searching at Proprietários, and somehow it managed to understand that the most important field for me is “nome” (name, in portuguese) and it works just fine.


As you can see in the image above, I can just add them by searching previewsly registered data at Proprietários

But when it comes to the other field: Imóveis, I just can’t add them, even though I used the same strategy.

So even if I try to manually add one, it won’t, and I can’t search inside previously created Imóveis.

Hope it’s understandable, if u need any more info just hit me up

Thanks again :slight_smile:

Can you share screenshots of the Data types tab showing the fields for each one of those data types you mentioned?

Sure!

Here’s how it’s done at Proprietários:

What I did was this:
image

And here’s how it’s at Imóveis:

I did this:
image

Basically the same thing but somehow it works for one and not for the other and idk why

Thanks again for helping, I’ve spent more hours today trying to solve this and still nothing , driving me crazy haha

Okay, I think I understand what you are saying, and I think I know what’s tripping you up. You are trying to manually add things to the list fields, and in one of them, you can type something like the name and find what you need, but in the other one, you can’t. If that’s what is happening, click this button and see if the data type that you can’t search has its primary field set to unique id.

primary

If it does, change the primary field to another field, and then you should be able to type the values that are found in that field in order to add items to the list.

Oh thank god, you are amazing, this was really getting me crazy!

Thank you so much for your patience :slight_smile:

Kind Regards,
Rodrigo

1 Like

Hey, Mike, there’s another thing bugging me and idk if you can help me out.

I’m still having trouble with this and didn’t want to bother you but I’m just hitting the door eternally xD

So I did try creating a new data type just to link “adress” and “owner” and test if I could link and use the new date type easily.

image

idk why I can’t just use the adress (endereço) value, without complementing more, while the owner (proprietário) is ok, do you have any idea?

Thanks in advance,
Rodrigo

So, first, was it intentional to make the address and owner fields lists? If it wasn’t, you will have to delete those fields and add new fields that aren’t lists.

Next, can I assume the owner field is a text field and the content format of the input that is being used to populate that field is also text? If that is correct, the fact that the types match is why you aren’t having a problem there. That being said, what is the field type of the address field and what is the content format of the input you are using to populate the address field? I’m guessing there is a mismatch there.

By the way, if you click on the red text at the top of your editor that shows the number of issues you have, it will help you understand the reason the expression is red.

1 Like

Oh god, I’m embarassed, I thought you didn’t answer me and just realized you did, 2 weeks later, I’m really sorry about that!
What I did there was basically what you told me to do at your first response (if I got that right):
I created an owners data type in which the name = text
I created a properties data type in which the adress = text

At owners data type, the adress field is a list with its field type being properties
At properties data type the owner field is a list with its field type being owners

But somehow it just works out for one of those (owners)

I’m wondering if I should register the adress first on another data type and then later just add stuff to it but that’d feel so much extra work, idk. The way it is now I’ve already registered an owner’s name and later I’m just registering an adress with all it’s properties, such as neighborhood, postal code, owner, etc… but somehow it doesn’t work so good :frowning: what do you think it could possibly be?

Thanks a bunch again and sorry for taking so long to answer, even when it’s 100% my interest here