Setting FB varables from custom actions for later use

Hi,

I have a couple of C#.NET FB custom actions with one property page each. One of them is for setting build information before comensing the actual build. The property page has a group box with radio buttons chosing which subversion action to take, a WriteData script transferes the choice into a FB variable (Propeties.PropertyAsString("X") = Page.ControlNameX.Text), and the action works as predicted when checking the action property in the properties inpector tab. The problem comes later when I am to use this FB variable in a switch statement: only the FB default value show up, whether it is set to empty or any of the other accepted values. I've unchecked the resetting of variables of runtime and checked the 'Current Values' in the FB Options - Variables, but to no avail. What am I doing wrong? Something else I should try?

Hi Charlotte,

You’ll need to set the value of variable in the actions OnExecute event, the script to do this will be:

var propertyValue = Context.ExpandExpression(Properties.PropertyAsString(“PROPERTY_NAME”));
Context.SetVariable(“VARIABLE_NAME”, propertyValue);

Regards,
Paul.

Hi again,

I added an OnExecute event in custom action .fbap, made sure the UI Script Language was set to JavaScript and added your example code to the script tab for my action in FB. Did not work.

I still just got the default value of the FB variable when entering the switch statement (where the expansion of the variable happens).

What did work though is when I put this code into my C#.NET custom action function Execute() and changed the internal variables from int to string.

Thanx for your help,

Charlotte