Variable indirection (for choosing which variable to log to)

Is there any way to do variable indirection within FinalBuilder? That is, to create a variable which, when set to another variable's name, then refers to that variable? Or to pass a variable "by reference" instead of "by value"?

Here's the scenario:

I'm using Finalbuilder to build a whole series of Visual Studio solutions, one after the other.

I need to do this four times, for four different solution configurations (release, debug, and two others).

At the moment I have an Async action group, containing four action groups, each of which contains the same series of "Build VS.Net Solution" actions.

Each action group has a variable "ConfigName" specifying the configuration name (Release, Debug etc). Every "Build VS.Net Solution" action refers to this ConfigName variable.

This all works fine. But I also need to have any errors logged to different logs for each configuration. So I have four variables ("ReleaseLog", "DebugLog" etc). My OnFailure action lists check whether each of these is non-empty, and if so logs them to disk / emails them out etc.

The problem is that, for each "build solution" action, I have to specify which variable to log to, and there's no way to do any redirection. I can't say "redirect the error logging to the variable whose name is specified by the "LogTarget" variable, that sort of thing.

This means I can't create one action list, and call it four times within an Async action group, because I have no way of redirecting the errors to a different variable. So each time I want to change the list of solutions, I have to do it in four places (and be very careful I've set up which variable they log to correctly!).

Is there any way around this? I've searched  these forums for "variable indirection" and "change log variable dynamically" etc, but I haven't seen an answer yet!

Thanks!

If you are doing the same thing over and over, define an Action List, and add action list parameters to pass the config name etc. You don’t need to variable indirection, you can just use the Run ActionList action with different parameter values.

http://help.finalbuilder.com/actionlists.htm?zoom_highlightsub=action%2Blist

Hi Vincent,

Thanks for your reply. Unfortunately it managed to completely miss the point of my question, which wasn't about how to pass different configuration names into an action list, but was instead related telling an action list which variable to log to!

Happily, I found a solution using scripting, so I thought I'd post it here. Essentially, I put all my "build solution" actions inside a group, and then I use some script inside the group's "BeforeAction" script which explicitly sets which variable all the child actions will log to. Then I pass the name of the desired log variable into the action list. Like this (Where TargetLog is the name of the variable you want to log to):

dim child
dim count
dim i

Action.LogToVariable = TargetLog

count = Action.ChildActionCount - 1

for i = 0 to count
  set child = Action.ChildActions(i)
  if not (child is nothing) then
    if child.ActionName = "Build VS.Net Solution" then
      child.LogToVariable = TargetLog
    end if
  end if
next

Perhaps this will be useful to someone.

Hi Stormcloud,

Thank you for posting the answer you found to work. Great to see the community involvement!