Accessing data "globally" #14430
-
Hi! i'm new to Budibase and i'm trying to build an app I've already built in AppSheet to see how it fares. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @Fabio53443 I'll take you through how I would get the last row of the customers table as a default value for the Customer field. Firstly, I've mocked up some sample tables, Next, in the design section, I added a I also added a Data Provider on the screen, and set the Data Source to be the customers table. Set the limit to 1, and disable pagination. Add a Headline component to the Data Provider, and set the value to be the binding of NB: The reason we chose to reference the customer name here is so that it's easier to debug. For your specific use case you may want to sort on an auto-column of Once you're happy with the Data Provider's settings, click the little cog-icon next to your customer field. You can set the default value of the customer field in the form to be what you picked out in the Data Provider, except instead of referencing the customer's name, you'll want the _id - Once you're happy with the Data Provider fetching the last customer-row in the table you can delete the Headline component from the Data Provider, but don't delete the data provider itself. Here's the app-export where I worked through this solution for you, download it and have a closer look if it helps. You can see more about how to import an app here. |
Beta Was this translation helpful? Give feedback.
Hey @Fabio53443
I'll take you through how I would get the last row of the customers table as a default value for the Customer field.
Firstly, I've mocked up some sample tables,
customers
andorders
, with some columns including a relationship between the two.Next, in the design section, I added a
Form Block
(although this walkthrough would also apply to aForm component
, as well as aMulti-Step Form Block
). Set the Data Source of the form to be Orders.I also added a Data Provider on the screen, and set the Data Source to be the customers table. Set the limit to 1, and disable pagination. Add a Headline component to the Data Provider, and set the value to be the binding of
{{ New Data Pr…