Ok. I got it your requirement now.
You can create query as show above by chaityanya and you would have to decide datasource for your query based on your Customer account from the other table. So Once you get the customer number you can query your above table where tablename , fieldname values are stored and from that you have to find the actual datasource which you want to query.
e.g.
Common common;
DictTable dictTable;
;
dictTable = new DictTable(_tablenum("YourTablename from config table based on your customer number "));
common = dictTable.makeRecord();
select common
where common.RecId == _recId; // you can use fields you want
Refer this link