Creating a variable with a complex value

Hello everyone!

I am making a table visualization in which I want to connect 4 pg data sources.
2 for prod, 2 for stg.

The first data source is cluster1.
The second data source is cluster2.
The third data source is cluster1_2.
The fourth data source is cluster2_2.

I created a switch prod/stg.

I created mixed queries:
prod
select * from cluster1.table1
select * from cluster2.table2
stg
select * from cluster1_2.table1
select * from cluster2_2.table2

Question: how to change cluster1/cluster1_2, cluster1_2/cluster2_2 depending on the switch prod/stg?

I used to have a simple query:
I created a variable env = PROD: cluster1, STG: cluster1_2
and the query was like this
select * from ${env:value}.table1

but now it’s not clear.

so the above is prod/stg?

sorry, I’ll try to express myself more simply.

I want to take an array of values ​​depending on the current state.

example of variables:
test1 = 1,2,3
test2 = 4,5,6

test3 = PROD : $test1, STG : $test2

there are 2 questions here:

  1. is it possible to get the value of test1 by index
  2. is it possible to get it from test3. something like ${test3:value[2]}