This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Help with custom bean, loops, and variable resolution
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 10, 2007
06:10 PM
Help with custom bean, loops, and variable resolution
My ISMP experience is limited, and my javabean experience even more limited, so I'm trying to figure out if this is a product failure, or if I'm doing something wrong.
If you have a looping sequence within a Wizard (using the "Goto Action" to jump back), and you're operating on a Java system variable that changes in each iteration, do you have to do any special in any actions within that loop that uses the variable?
I start off with a sequence of data stored in a java property $J(destination_list). This is a comma-separated list containing zero-to-N destinations that require a copy of a particular file. I wrote a custom bean that takes as parameters an input property name, a delimiter, and an output property name. The custom bean "pops" the first chunk off data out of the input property (removing that data from the contents), and stores it in the output property name. Then I built the following sequence within the Wizard tree:
Wizard Sequence (conditional on $J(destination_list having data)
-> GetProperty (removes next data iteration from $J(destination_list) and copies the removed data into $J(dir_var) )
-> Files Action Wizard (copies a file to $J(dir_var))
-> Goto Action (conditional on $J(destination_list) having data after GetProperty, goes back to Wizard Sequence).
The "Files Action Wizard" is a custom bean written by someone who is long gone from my company. It's just copying a file from a source based on $P(installLocation) and copying to location $J(dir_var). The $J(dir_var) is properly resolved on the first pass through the loop and that destination gets its copy. However, on the second pass through the loop, that action executes without resolving the new value of $J(dir_var). Based on some debugging (appending a temp file with "ASCII File Update" each iteration), the $J(dir_var) is being properly populated each time through the loop. But the copy is getting done multiple times using the same destination every time, regardless of the value of $J(dir_var).
My best guess at this point is that our custom bean is getting created the first time with the value of the $J variable, but the other loop iterations re-use the bean already in memory without re-setting the properties. I'm thinking it could be something along the lines of a condition with "Immutable: True". Is there something in the "Files Action Wizard" bean that needs to be done to ensure it resolves the input variables every time it's executed? Right now, all that's in there is:
Any suggestions?
If you have a looping sequence within a Wizard (using the "Goto Action" to jump back), and you're operating on a Java system variable that changes in each iteration, do you have to do any special in any actions within that loop that uses the variable?
I start off with a sequence of data stored in a java property $J(destination_list). This is a comma-separated list containing zero-to-N destinations that require a copy of a particular file. I wrote a custom bean that takes as parameters an input property name, a delimiter, and an output property name. The custom bean "pops" the first chunk off data out of the input property (removing that data from the contents), and stores it in the output property name. Then I built the following sequence within the Wizard tree:
Wizard Sequence (conditional on $J(destination_list having data)
-> GetProperty (removes next data iteration from $J(destination_list) and copies the removed data into $J(dir_var) )
-> Files Action Wizard (copies a file to $J(dir_var))
-> Goto Action (conditional on $J(destination_list) having data after GetProperty, goes back to Wizard Sequence).
The "Files Action Wizard" is a custom bean written by someone who is long gone from my company. It's just copying a file from a source based on $P(installLocation) and copying to location $J(dir_var). The $J(dir_var) is properly resolved on the first pass through the loop and that destination gets its copy. However, on the second pass through the loop, that action executes without resolving the new value of $J(dir_var). Based on some debugging (appending a temp file with "ASCII File Update" each iteration), the $J(dir_var) is being properly populated each time through the loop. But the copy is getting done multiple times using the same destination every time, regardless of the value of $J(dir_var).
My best guess at this point is that our custom bean is getting created the first time with the value of the $J variable, but the other loop iterations re-use the bean already in memory without re-setting the properties. I'm thinking it could be something along the lines of a condition with "Immutable: True". Is there something in the "Files Action Wizard" bean that needs to be done to ensure it resolves the input variables every time it's executed? Right now, all that's in there is:
public void setDestinationFile(String string) {
_destinationFile = string;
}
Any suggestions?
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 14, 2007
09:47 AM
In the execute method of Files Action Wizard, are you setting _destinationFile to the resolved string? I was doing something like that & it therefore was no longer set to "$J(dir_var)", but was actually set to "C:\Dir1". Try creating a local variable in the execute method.
Change from something like this:
to something like this:
Just be sure to change all your references from _destinationFile to destFile in the rest of that method.
Change from something like this:
_destinationFile = resolveString(_destinationFile);
to something like this:
String destFile = resolveString(_destinationFile);
Just be sure to change all your references from _destinationFile to destFile in the rest of that method.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 19, 2007
01:59 PM
Huh, I thought I had turned on email notification for this thread...
I had finally found the issue, and as a matter of fact it was exactly what you said. The original bean coder had included "_destinationFile = resolveString(_destinationFile);" in the execute() method. Storing the resolved string into a local variable (rather than the class variable) and working from that made my loop work, since the resolution would return the new value each time, as long as the class variable remained "$J(dir_var)".
Thanks for the help, though. It's nice to know that I'm not alone in running into odd issues like this.
I had finally found the issue, and as a matter of fact it was exactly what you said. The original bean coder had included "_destinationFile = resolveString(_destinationFile);" in the execute() method. Storing the resolved string into a local variable (rather than the class variable) and working from that made my loop work, since the resolution would return the new value each time, as long as the class variable remained "$J(dir_var)".
Thanks for the help, though. It's nice to know that I'm not alone in running into odd issues like this.
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)