Forum Academy Marketplace Showcase Pricing Features

How is "Field Type" [data type] handled?

I’m struggling to understand how field type [data type] is handled.

I’m uncertain what’s saved in the field. I guess it should be [data type] but that could be loads of params. Or is it for cross-reference purposes?

How should I look at it?

Look at is as a way to link Things to each other, which yes, can be used to create powerful cross-referencing. Here are a few examples:

Data Type
- Field (field type)

User
- Family Members (list of Users)
- First Name
- Last Name

In this example, we’re linking the same type to a field. A list of users as a field for the same user type allows you create connections like friends, followers, family members, etc. What it means in terms of the data is that you have access to the entire entry for each of those users…

Tom

  • John, Lisa, Dave
  • Tom
  • Jones

John

  • Tom, Lisa, Dave
  • John
  • Jones

Lisa

  • Tom, John, Dave
  • Lisa
  • Jones

… etc.

So, if current user is Tom and you added users to Tom’s list of Family Members, you could then retrieve their data through Tom. Say you have a profile page and a repeating group to display the current user’s Family Members. The source of that repeating group would be “Current User’s Family Members” - and in each cell you could have text elements to display first name. That text element would be “Current Cell User’s First Name” and your RG would then be a list of Tom’s family members’ first names.

Other Examples:

Company

  • CEO (User)
  • Projects (list of Projects)
  • Staff (list of Users)
  • Address (geo location)

Project

  • Name (text)
  • Due Date (date)
  • Company (Company)

(Where projects is also a custom data type allowing you to search companies by projects or projects by company)

Movie

  • Actors (list of Actors)
  • Title (text)
  • Votes (number)

Actor

  • First Name
  • Last Name
  • Age
  • Movies (list of Movies)

See how you can create these 2-way connections? It all depends on what you want to do and how you want to handle your data. Hope this helps.


Gaby | Coaching Bubble

4 Likes

Big Thank you for the elaborate reply. I hear you fully on your well explained examples. That is clear. And I’m sorry my topic was badly defined. I didn’t mean [another thing]. I meant [data type]. Updated.

What I’m after is to understand what happens if I reference only the data type, like below for the “Creation ID”. There’s no error presented, but in what scenario would you use only the [data type] if bubble can’t interpret the data type without a field value anyway?

In the corresponding data tab > fields for type Order, I have:
<------- field type

Aaahaaaa! SO:

A custom data type is referenced as (in my case above) by the “primary display field” = the field defined in:
<----- primary fields
"Parent group’s Creation = ID in:

Whadday know you could learn eyh. :slight_smile:

The primary display field allows you to designate a field to serve as the identifier for display purposes in your Data table, but by setting a field type to a custom data type, you have access to every field’s value in that data type.

My User type has:

  • first name
  • last name
  • email
  • phone number

My Company type has:

  • company name
  • ceo (type user)

If I’m looking at my Company table, I can set the primary display field of CEO to be the User’s last name instead of phone number because when I’m looking at the table, the last name is much easier to see who is who. So the primary display is for display purposes.

Having said that, knowing that you can set any field within the data type to be the primary display should tell you that the value of that field (that is set to a data type) actually represents the entire entry for that thing. The value of CEO (type user) actually gives you that User’s first name, last name, email, phone number…

Maybe you did get this and I’m just repeating us both, but there are the extra words anyway :wink:

2 Likes

If I’m looking at my Company table, I can set the primary display field of CEO to be the User’s last name instead of phone number because when I’m looking at the table, the last name is much easier to see who is who. So the primary display is for display purposes.

I agree with you on the first part but not the last sentence. I have a data type [Order] with a field [Creation ID]. When a new Order is created I capture the Order>Creation ID by using where [Order>Creation ID] is of Creation Field type, and primary field of Creation is “Creation ID”. If the primary field would only be for display purposes, I should get an error here. And the editor would ask for another param. Right?

by setting a field type to a custom data type, you have access to every field’s value in that data type.

This is however very important and probably sums up your reply to my initial topic pretty good! Thanks again.

The field is correct because “Creation ID” is type Creation, like you said. And the value you’ve entered is Parent group’s Creation, so you have:

Creation = Creation

represented by labels… the field label (Creation ID) and the database path to the Creation you want (Parent Group’s Creation).

A clearer example would be with Users. I have a field called “Friend” under the User type. The Friend field is type User. I want to attach a user to another user and call it their friend. So:

User

  • email
  • first name
  • last name
  • friend

User A

User B

  • [email protected]
  • amanda
  • williams
  • no friend…meaning her friend field’s value is empty.

Ok, so since the Friend field is a User type, that value is the entire entry for another user, but in order to read it in a table, that entry needs to be represented by one of its fields, which is where Primary Display comes in, it’s purely an identification setting for your data table (and CSV uploads) and nothing more. In my example above, I used the first name as the primary display, which is why you see “amanda” in Bob’s friend field. If I wanted the display to be email, then my table would look like this:

User A

That setting has nothing to do with what you see when you’re setting values in workflows. Now, when adding Amanda to Bob as a friend, our workflow would actually look like this:

Make Change to Current User (Bob)…

Friend = Parent group’s User OR Friend = Search for Users > Constraint: Email = [email protected] OR Friend = Current Cell’s User (if you’re selecting her from a repeating group) OR Friend = any PATH in your database to the User entry for Amanda.

It would never look like this: Friend = Amanda because “Amanda” is just text and that value needs to be a user entry.

Ok, does that clarify? Because that concept will help when you’re building and I don’t want you to get stuck when trying to save data.

I’m going to get a snack now.

Hehe, we’re both saying the same thing (more or less lol). I totally get your reasoning and your examples. I totally agree with everything you’re saying, before and now. :slight_smile:

When I said I didn’t agree with

So the primary display is for display purposes.

it was because I thought you meant there was no real underlying data in the representation.

I definitely understand that it’d never be “Friend = Amanda”. Like you say, Amanda is just a value and not a variable.

Initially I was confused about the representation of the data type without definition.

Hope the snack was good. I’m going to bed now.

1 Like

High five @jonaspalmqvist :raised_hands:

and goodnight!

:punch: @romanmg

@romanmg, I just read your weekly email – thanks for putting that together, btw, super useful.

One follow-up question. My impression was that changing the primary display field impacted both 1) the way it’s displayed to a user in the excel like database tables and 2) the field bubble uses to for searches, etc. within the application.

As such, setting it to a field that’s not guaranteed to be unique would create problems. Am I understanding this correctly? …or does, changing the field only impact the display in the admin panel and not the actual funtioning of the application?

Thanks!

Thanks, @sridharan.s! I’m glad you’re enjoying the newsletters :slight_smile:

Yeah, it’s only for display. Has nothing to do with/nor affects workflows/values, etc. See reference link below for Primary Fields.

1 Like

Thanks for sharing! Very helpful.

@romanmg - Gaby,
Do you know if you can only tie Things together by text field types? When I try to tie two things together via a number field type, the search (when I speficy which thing I’m relating or tying together) for number fields never gives me results. But if I delete that field and recreate as a text type then I can find those fields.

Hi @Blake, do you have an example link? The type of field within types shouldn’t matter, but I want to make sure I’m understanding what you’re trying to do.

here you go: https://bubble.io/page?name=index&id=materialdesign&tab=tabs-3

I created the following Data Types and fields:
Text Data with “Text Field” of text type
Number Data with “Number Field” of number type
Linked to Data with “Linked Number Field” of “Number Data” type and “Linked Text Field” of Text Data type.

When I go to the app data and try to link the Linked Number Field to my entry in Number Data, nothing returns in the search. But it does work for the Text data. (clear as mud?)

Hey @Blake, I think your app is on private. You can switch to public in settings, but I think I already know where this is headed. I think you’re close. Let me know when you’ve changed the privacy setting.

Sorry about that. Hopefully you can get to it now…?

I don’t think I’ve ever noticed this, but you’re right… you can’t call up an entry via a number field. I added another text field and it’s the only one that responds. Not sure if this is a bug or intentional. I also tried creating a front-end solution with a search box, but same deal - you can’t search a number field, only text.

At first I thought your question was in reference to mismatched data sources or just getting the right syntax to link records. Anyway, I think your solution for this would be to have an additional text field and store numbers as text as well in order to retrieve them like this, whether on the back end or via a search box element on the front end.

Ok, thanks for taking a look. The other thing I’ve noticed is I can’t link to the built in user data at all. Even if I add text fields to that data type I still can’t link to them. Do you know if you should be able to link to user data types?