Forum Academy Marketplace Showcase Pricing Features

Search from Database and load data into input fields

Hi,

I have completed the bubble training lessons and have also gone through the documentation, however I am finding it difficult to implement a search feature.

So, I have a Customer data type with fields: Mobile_number, Name and email

image

I need the user to enter his mobile_number and search. When the search button is clicked, I want to search from the database and load all the fields as input fields if an entry is found. If there is no entry for that mobile_number in the database, the user will continue to enterthe rest of the details like Mobile_number, Name and email in the same input fields and click on “Update” button, so a new entry is created in the database.

In the search button workflow, I am using Display Data to search the database and load the results. But I am finding it hard to load the search result fields into the corresponding input fields.

Most of the examples shown in the forum and the training lessons are to do with Repeating groups. But I dont think I need to use a repeating group here as the search result will have only one entry (mobile_number is unique/primary key).

What’s the best and most efficient way to implement this ?

Appreciate if anyone can help me out here.

Thanks
Vineeth

I’d do the following…

  1. Set the group containing the inputs to have a content type of Customer

  2. Set the default values for the inputs to be the parent group’s Customer’s field values.

  3. When the search button is clicked, use Display Data to set the Customer of the parent group by doing a search for Customers who’s phone number matches the phone number input’s value :first item.

You’ll need to use 2 conditional workflows on the Update button click - 1 to update the parent group’s customer (if there is one), and another to create a new customer (if they don’t yet exist).

Thanks Adam for responding quickly.

I tried following your steps, I am a little confused on your 3rd step.

When I choose the Display Data, I get to pick either the Parent Group -OR- do a search for customer’s phone number. I cant do a search for a parent group.
I did a search for customer’s phone = input phone number in display data, but it doesn’t work.

Any thoughts ?

I meant display the data in the input’s parent group. So the parent group (whatever that is) is the element you want to display the data in. (Although it could be any other group on the page for that matter - it really doesn’t matter which group it is, it depends how your page is set up).

The data you want to display is the Customer.

So do a search for the customer who’s phone number matches the input value.

If it’s not working for you then you might need to check any privacy rules applied to your Customer datatype, as that may be restricting what data can be found in searches by certain users.

If you still can’t get it to work feel free to post some screenshots of your current workflows and page/form structure etc. so someone here can see where you’re going wrong.