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.

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.

1 Like

@AviSyst_Admin

I think I misunderstood your explanations :sweat_smile:
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 :stuck_out_tongue:
Maybe @Steve will have a better idea ?

1 Like

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. :slight_smile:

3 Likes

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

Rob.

1 Like