PDA

View Full Version : Using indirect property variables



IsaacG
09-05-2005, 07:51 PM
Back again.

Trying to set an environment variable using userinput as the source. Basically I want to read in an environment variable and use it as the value for an edit box. So I set a property called var1 to %SOURCEVARIABLE and set an editbox with property var1 as indirect.

This causes the edit box to display the value of the systems environment variable. Lets pretend the value of SOURCEVARIABLE is "Bob"

The user edits the value to "Bob Lloblaw", and now I want to take that input and set it into the new Environment Variable named DESTVARIABLE

So in System Config \ Environment Variables I create a entry called DESTVARIABLE and I set the value to property [var1]

You would think that would do it, and the system would set an environment variable named DESTVARIABLE with the result of the edits made by the user in the edit controlr. Instead I get the literal string %SOURCEDIR set as the value.

So the environment variables section isn't expanding the value of var1

I traced this all with a debugger, and not only does the debugger see var1 as having the expanded value, it also shows %SOURCEVARIABLE as having been updated with the new value, which is something I didn't think would happen.

Anyone know of a better way to get this done?

IsaacG
09-05-2005, 08:34 PM
You know, forget how complicated that all was - lack of sleep is certainly taking its toll.

I simplified the problem.

A simple edit box with uninitialized property 'var1', no indirect values to worry about. The user types in the value "Bob", and the system configuration / environment variable has a entry named Doug with value '[var1]'

No environment variable is set - which tells me that var1 was never set as far as the Environment variables are concerned. I made certain that there was no Var1 in the Property Manager for the test. If there is one, then the environment variable gets set to whatever the default is, not what the value is actually set to.

So even though WriteEnvironmentStrings takes place at the end, the dialog still resolves its values long before the GUI.

No solution though - I suspect that once again I need to use InstallScript to get the job done.

RobertDickau
09-05-2005, 10:34 PM
You might want to use a "public" property, one with an all-caps name: MYVAR instead of myvar. Only public properties survive the jump from the UI sequence (when the dialog box is dispayed) to the Execute sequence (when the environment variable is written)...

IsaacG
09-06-2005, 09:15 AM
Thanks, I really appreciate the help. I knew capitilization determined which properties were accesible from the command line, but I hadn't realized that it also defined scope between the sequences.

So that solves the issue of getting a value into the environment variable. And it works great, until the value I want to write is an inderect reference to an existing environment variable.

Property manager : VAR1=%ENV1
Dialog Edit Control [indirect] : VAR1
Environment Variables : ENV2 = [VAR1]

This writes ENV2 as literally %ENV1, not the value of ENV1. What can I do to 'seed' the value of the edit control with the value from ENV1?

RobertDickau
09-06-2005, 09:21 AM
The Property table doesn't expand [PROP] or [%ENV] expressions (specifically, it doesn't use the Formatted data type). You'll probably want to use a set-a-property custom action to set VAR1 to [%ENV1], since that custom action type does expand bracketed expressions.

chenkunji
09-28-2006, 11:02 PM
Help me!
I want to create a IIS Virtual directory with name come from useinput from a edit control on a custom dialog1.
I have create custom dialog1 with a edit control with the following property:
Indireact Property:True
Property:PORP_AAA

In the property manager,I create a new localizable property:
PORP_AAA:{ID_PORP_AAA}MyVirtualDirA

In "Server Configuration>Internet Information Service" ,I create a new Website "MySite",and a new Virtual directory with property:
Name:{ID_PORP_AAA}MyVirtualSiteA

then Buidle the project,and run it.I input edit control with value "MMyVirtualDirA_BBB". I think a Virtual directory will be created. However,when setup finished,the name of the Virtual directory is not "MMyVirtualDirA_BBB",instead of "MMyVirtualDirA".

So,how can I create a Virtual directory with name "MMyVirtualDirA_BBB"?

To solve the problem,I proceed:
1)
In "Server Configuration>Environment Variables" ,I create a new Environment Variable ,with property:
Name:MyENV1
Value:[PORP_AAA] //(and then I changed Value to {ID_PORP_AAA})

2)
In "Behavior and Logic>Custon Actions" ,I create a "New Set Property",with property:
Property Name:PORP_AAA
Property Value:[MyENV1]

But it still doesn't work!

Who can help me?The problue has troubled me 3 days!

davidh
10-10-2006, 12:40 PM
I'm a bit confused. Just to be clear, what is the value of the 'Name' field on the General tab of your Virtual Directory? I'm thinking either there is a problem with what you have entered here, or maybe your property is not being resolved as expected somewhere else.

As an example, if you want the value of MYPROPERTY to be used at runtime, entere [MYPROPERTY] in the 'Name' field.