Get and use table name from a drop down list value

I would like to use the value from a drop down list to reference a table. i.e I have 4 trucks in the drop down list and each truck has its own table. When I choose the truck called “Acco” from that list (Column name is “Truck”) I want to find the last row in the “Acco” table.

I think I’m ok with finding the last row, but I can’t get the value from the drop down list to be the table name. I have been trying using [Truck] as the table name but all the expressions fail when I do that. If I replace [Truck] with “Acco” the expression works fine.

I have also tried TEXT([Truck]) and [_THISROW].[TRUCK] but nothing has worked so far.

Any help would be great.

Rob.

Solved Solved
0 5 145
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

There is no way to use a column value to directly identify a table name for a reference, unfortunately. The best you can do is us a conditional to choose the suitable dereference:

SWITCH(
  [Truck],
  "Acco", LOOKUP(..., "Acco", ..., ...),
  ...,
  ""
)

Restructuring your data so that all trucks are contained in a single table is the right choice.

View solution in original post

5 REPLIES 5

Aurelien
Google Developer Expert
Google Developer Expert

try this:

ANY([Truck])

Thanks Aurelien,

That didn’t work I’m afraid. I have actually gone around this a completely different way and managed to keep all the data on one table for now. So wont need the solution to this anymore, however I would be interested to find out how to do it

Cheers,

Rob.

@AviSyst_Admin

I think I misunderstood your explanations
The easier way would be to use a common table for all trucks, with a column added such as “Truck” to differenciate each part, and combine that with a Slice having row condition [PickedTruck]=[_THISROW].[Truck] or something in the same idea (not sure to make myself clear).
I guess you decided to proceed this way in the meantime ?

However, I don’t know if it’s possible to switch table that easily, because the Type “Table” does not exist
Maybe @Steve will have a better idea ?

Steve
Platinum 4
Platinum 4

There is no way to use a column value to directly identify a table name for a reference, unfortunately. The best you can do is us a conditional to choose the suitable dereference:

SWITCH(
  [Truck],
  "Acco", LOOKUP(..., "Acco", ..., ...),
  ...,
  ""
)

Restructuring your data so that all trucks are contained in a single table is the right choice.

Thanks Steve, glad to know I wasn’t just missing something.

Rob.

Top Labels in this Space