Selecting a group of records then changing one field

I’ve run into a problem with a workflow that seems to me should be easy so maybe I’m going about it wrong way.
I’m creating an app to manage our cattle ranch. We have various pens, pastures, etc and move all or some of the cattle to different places throughout the year.
I also want list of occupants in the Location data type. That part was easy. I created a custom state “Cattle Selected” on the Locations Page, then populated the “Occupants” List field.
However, I want to also change the “Location” field on each animal’s record to the name of the location they were moved to and this is where I get stuck. I can’t seem to get to the individual records in the list contained in the custom state or in the Locations data type.
I hope all of this makes sense. Any help or suggestions would be greatly appreciated.

Hi there, @tacknstock… if I understand your post correctly, can’t you use the Make changes to a list of things workflow action, with the list to change being the custom state’s value (which I believe is a list of cattle)? It seems like you could use that list and change the location field to the appropriate location, but I could be way off going by just the info you provided. If I am off base, consider sharing some screenshots of your setup, and I’m sure someone will be able to help you out.

Best…
Mike

Hi, mikeloc. The Make Changes To A List of Things workflow only allows changes to the list as a whole, ie add or an item, etc. You can’t make changes to the individual fields within the records. I got around it by creating a workflow to change each record when I click on it. That’s fine for our small herd but if I ever decide to try and market this, it’s not going to be a great option for someone who wants to move a couple hundred cows.
I thought about including some screen shots, but I wasn’t sure what people would need to see. What would you recommend I show?

What do you mean, you can’t make changes to individual fields?

Why can’t you just change the location field to the specific location on the list of Cattle?

Yup, what Adam said… you sure can change individual fields. Maybe share some screenshots of how you are trying to set up that workflow and why you think you can’t make changes to an individual field when making changes to a list of things.

Well, obviously I missed something somewhere. I’ll take some screenshots tomorrow. Thanks for the replies so far.

@mikeloc and @adamhholmes Thanks for your input so far. Here are some screenshots showing what I’ve got so far. When I go to the workflow of the Save Selected button, I can’t find the Location field of the records in the custom state. Make Changes to a List of Things gives the error shown in the screen shot and Make Changes to a Thing doesn’t allow me to access the Cattle Data Type.
I know the answer is probably right in front of me, but my brain is stuck in an endless loop and I don’t have an escape key. LOL



Screenshot 2022-09-25 092101

I believe you are using the wrong workflow action. You are making changes to a thing (not a list of things), and then you are trying to set the thing to change to a list. There is a workflow action called Make changes to a list of things. Select that action, and set the list to change as location's Cattle Selected. Then, you should be able to change the location field as part of that action.

1 Like

Firstly, looking at your screenshot, you’re trying to make changes to a single thing, not a list of things…

To make changes to a list of things, you need to use a ‘Make changes to a list of things’ action (not a ‘Make changes to a thing’ action as you currently are…)

But regardless of that, you make the changes to a thing’s (or list of thing’s) fields by first defining the thing (or in your case list of things), then clicking the Change Another Field button to select the field to change, then setting value accordingly.

1 Like

Update:

Also, the expression you’ve defined in your screenshot (in red) is evaluating to a list of texts… (not to a list of Locations, as I would expect it to)…

So I’m guessing your Cattle datatype doesn’t actually have a Location field, but rather just a text field called Location, so you’ll need to fix that if that is the case as well.

1 Like

I’m not sure I understand what you mean. Yes, I have a text field named Location. How else could I do it?

That’s what I’m doing (or rather attempting to do) in the screen shot. I set the workflow to “Change a List of Things” and that was the result.

It sure looks to me like you are using the first action in this screenshot, and you need to use the second one.

Yes, I have a text field named Location. How else could I do it?

Surely you’d want the Location field to be a Location, not a text…

Using a text just makes everything more complicated…

that’s what I’m doing (or rather attempting to do) in the screen shot. I set the workflow to “Change a List of Things” and that was the result.

In your previous screenshot you’re not using ‘make changes to a list of things’… you’re using ‘make changes to a thing’… those are two different workflow actions…

You need to use Make Changes to List of Things

The Type of things to change should be Cattle

The List of Cattle To Changes should be the Custom State Selected Cattle’s Value (which should be a list of Cattle).

Then add the field to change to be Location, and set it to the Current Page Location… except that won’t work as the Location field is a Text, so you’ll need to select a text value from the Location datatype to set the value to (such as the Location’s Name)…

But to do things properly, get rid of the Location text field, and add a Location field that’s actually of Type Location… then just set that field to the Current Page Location in the workflow as described above.

If you look at the error message, it says I’m trying to change a “list of texts” but in a way, you’re right. Adam hit upon the root of the problem. My Location field type is text and I was attempting to add the Name field from the Location table. I should have made the Location field type a Location.

I’ve been wrestling with this so long, I’ve sort of developed tunnel vision, but I get it now.
I took the whole day off yesterday to clear my head. Thank you SO MUCH for your clear, step by step instructions. That was exactly what I needed to get out of that endless loop I was in.

1 Like

Welcome to brick wall #2. I also want to do what amounts to the reverse of the first action. I have a field in the Locations table called Occupants. Its type is a List of Cattle. I want to update this field with the list of cattle contained in the custom state. I had assumed I would use Make Changes to a List of things again and select the Locations table’s Occupants List but that isn’t one of the options presented. I probably have everything backwards again, but again I can’t find my way out.
Honest, I’m not usually this thick. I normally have no problem with workflows. I just seem to have some kind of mental block with this situation.

That one should be pretty easy, @tacknstock. You would use the first workflow action in the screenshot I shared earlier (i.e., Make changes to a thing). The thing to change would be the Current page's location, and the change to make would be Occupants set list location's Cattle Selected. Want to give that a shot?

As a newbie to Bubble and this forum I gotta say this sort of help the community gives is inspiring. And you not only help someone move forward with a great indie project but you are also teaching us bystanders in the background…so thanks!

3 Likes

Thanks so much for all the effort you guys are putting in here. I’m really sorry to be such a bother! I tried what you suggested but Current Page’s Location isn’t an option either.