Reference variable / database field using another variable's value

Reference variable / database field using another variable's value

  

I am writing actions to backup my data to AWS databases. Transit, API calls all going well. I do have a lot of fields and a lot of tables. At the moment its taking a long time to create an action to push data and and I haven't started on writing one to retrieve the data.

I started writing a generic action, thinking that I'd create a static entity with fields including the name of the tables, the name of the fields, the data type, and then just have some loops and ifs which construct the json for the API calls etc. Rather than what I'm currently doing which is to have an assign and custom written bit of text construction for every single field in every table.

Thing is... to be able to use my nice static entity, I'd need to reference a variable from the value of the variable in the meta table, something like 'GetTableBeingBackedUp.List.Current.[GetMetaTable.List.Current.FieldName]'

My square brackets are just me making up a possible syntax. I don't suppose that that sort of referencing exists does it, or if someone can suggest a different way? Its not just that I'm lazy and writing the actions will take a long time, its also that I'd like to be able to grow my app without having to laboriously update the backup algorithm (remembering how it worked and so on) rather than just adding a record to my metadata table.

Any suggestions welcome! Thanks!

Hi,

Why not create dynamic query? 

Solution

If you REALLY wants to create a "generic" backup system (you will still have to update the metada), you will have to resort to use a Dynamic query, I guess.

In this case, you can use the Expand Inline property of query parameters set to 'Yes' and pass pieces of your query to inside the SQL comming from the logic, like table names, field names, etc., that you can fetch from your metadata table.

But maybe someone else has a better idea. 

Cheers.

Solution

Thanks both. That seems to be getting me on the right track.