Hi @rob4681,
As long as both lists contain the column 'Batch ID', the function will not throw an error. Please note that by using a variable you are no longer pointing directly to your datasource but rather a local copy of the records stored within a variable (similar to a collection). Storing your rows in a variable or collection is non-delegable, meaning you can only store up to the Data Row Limit defined in your app settings.
'Dynamically' referencing your datasource (or e.g. a column) is generally done by using a Switch statement:
Switch(
varDatasource,
"Prod1",
LookUp(TableProd1, 'Batch ID' ...),
"Prod2",
LookUp(TableProd2, 'Batch ID' ...)
)
This set-up would still allow the Look-Up to be delegable (if your condition is delegable). Both the variable and Switch approach require that the columns you would like to access have the same name in both datasources (the column schema must match). If a small number of columns are different, you could map these with the AddColumns function.
When the datasources have completely different schema's, you may want to use separate galleries with conditional visibility. However, be mindful of app performance when choosing this approach.
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!