Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.

Copy Data From One Table, To Change Data On Another Table

Hello,

I have a table called FleetRequest where our employees go in and request a vehicle to use temporarily or permanently. Then there is a table called VehicleAsset that holds all of the vehicles we have in stock. I set it up where from the request there is a dropdown that references VehicleAsset and displays the vehicles that are currently unassigned. You can then save that vehicle to that request and mark it completed.

I wanted to make an action that passes on the driver name from the request over to the asset table.

FleetRequest[employee_name] -> VehicleAsset[assigned_driver]
VehicleAsset[vehicle_status] = โ€œ4โ€

Status 4 is a referenced table that equals โ€œAssignedโ€.

I made an action:

I used: ANY(FleetRequest[employee_name])
because it gave me an error if I used: FleetRequest[employee_name]

โ€œThe expression is valid but its result type โ€˜Listโ€™ is not one of the expected types: Refโ€

I then tried to make a WorkFlow, which is where I found my issue.

I canโ€™t add the action I made because it is from another table.

Of course, any help with this would be much appreciated. I am truly grateful for this community. You guys have helped me with multiple things thus far.

So thank you.

Solved Solved
0 10 322
1 ACCEPTED SOLUTION

My [requested vehicle] was just an example column name. Looks like you should use [vin_number] in its place, assuming that is a Ref type column pointing to the VehicleAsset table (or a slice of that table).

View solution in original post

10 REPLIES 10

Youโ€™ll need to utilize the Action type โ€œExecute an action on a set of rowsโ€ to trigger your action from the origin table.

Okay cool, thanks. I will look at this now. I had issues narrowing down how to search for it lol

Yea I kinda went down this road earlier today. This is what I made, that didnโ€™t work.

I made a new action like the one you mentioned, but I could not figure out what to put in the Referenced Rows section.

I figured maybe adding [employee_name] but got this:
3X_a_2_a2c8ac672511818aa4b2d8037a40420d66338649.png

I need to change both:

VehicleAsset[assigned_driver]
VehicleAsset[vehicle_status]

So what am I putting there?

In the app example I looked at earlier this morning, it put [Children] in there but I am not trying to change a referenced row. If that makes sense.

App Example:
https://www.appsheet.com/samples/This-app-shows-how-to-use-reference-actions?appGuidString=e76d2e73-...

Disclaimer, Iโ€™m only skimming your posts and not examining in huge detail.

Youโ€™re selecting a vehicle in the request table, thatโ€™s a Ref column, pointing to vehicles table, is it not? Thatโ€™s what you use for the Referenced Rows field, but you have to put it inside of a LIST() as well. So:

LIST( [requested vehicle] )

Not sure I follow completely.

Yes. The FleetRequest[vin_num] column references a slice from VehicleAsset that displays โ€œUnassignedโ€ vehicles to choose from.

Once one is picked and they click save, I want to change 2 values for the vehicle associated to that VIN on the VehicleAsset table.

Not sure where [requested vehicle] is coming from.

My [requested vehicle] was just an example column name. Looks like you should use [vin_number] in its place, assuming that is a Ref type column pointing to the VehicleAsset table (or a slice of that table).

That worked. But as always, you fix one thing and thereโ€™s another issue that pops up. I think being a developer and having the mind of a developer, can cause issues when trying to use AppSheet; since itโ€™s made for non-developers lol

It passes along the changes properly based on the vin, but it has an error when trying to pass along the employee name to then become the assigned driver.

3X_1_d_1df9f3ff3f9e51c30584e4e5340fe89cc9e7dd1b.png

Youโ€™ll need to choose the most recent value. I would combine a MAXROW() expression to get the key value from the row with the highest rownumber, then use it in a LOOKUP() expressions to get the employee name. Something like:

LOOKUP(
MAXROW( request[name] , โ€œ_rownumberโ€ , [requested vehicle] = [_THISROW] ),
โ€œrequestโ€,
โ€œkey columnโ€,
โ€œemployeeโ€
)


With a little finesse this morning

LOOKUP(
MAXROW(
โ€œFleetRequestโ€, โ€œ_ROWNUMBERโ€, [vin_num] = [_THISROW]),
โ€œFleetRequestโ€, โ€œuuidโ€, โ€œemployee_nameโ€
)

That worked.

I appreciate ya @Marc_Dillon

Top Labels in this Space