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: Installscript function to return multiple values
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
‎Oct 08, 2007
08:47 PM
Installscript function to return multiple values
How do I get an installscript function to return multiple values. I realise the help says to use BYREF, but I'm not passing any parameters TO the function, I just want to return 3 values.
Kinda like this :
Kinda like this :
export prototype STRING GetSQLDir;
//---------------------------------------------------------------------------
// GetSQLDir
//
// Function to be run during an upgrade and new install.
// Determine the path to SQL Server data and log files
// Determine the path to SQL Server backup files
//---------------------------------------------------------------------------
function string GetSQLDir()
STRING svFnSQLPath, svFnSQLBackupPath, svFnSQLDataPath;
begin
svFnSQLPath = "C:\test";
svFnSQLBackupPath = "C:\test\backup";
svFnSQLDataPath = "C:\test\data";
return svFnSQLPath, svFnSQLBackupPath, svFnSQLDataPath;
end;
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 09, 2007
01:19 AM
You must pass the parameters to the function by reference.
-Nick
-Nick
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 09, 2007
01:46 AM
Ok, thanks. Still just a little confused with the syntax. Can you please help me out?
I realise I'm off with the syntax somewhere.. can you please let me know how I should be using this?
export prototype GetSQLDir( BYREF STRING, BYREF STRING, BYREF STRING);
//---------------------------------------------------------------------------
// GetSQLDir
//
// Function to be run during an upgrade and new install.
// Determine the path to SQL Server data and log files
// Determine the path to SQL Server backup files
//---------------------------------------------------------------------------
function STRING GetSQLDir(svSQLPath, svSQLBackupPath, svSQLDataPath)
STRING svServerName, svComputerName, svServerInstance;
STRING szKey, szName;
NUMBER nBuffer, nvType, nvSize, nStartPoint, nvComputerName, nLength;
begin
//Code here to set the 3 variables
svSQLPath = "C:\TEST";
svSQLBackupPath = "C:\Test\Backup";
svSQLDataPath = "C:\Test\Data";
return svSQLPath, svSQLBackupPath, svSQLDataPath;
end;
I realise I'm off with the syntax somewhere.. can you please let me know how I should be using this?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 09, 2007
08:35 AM
To return a value through a BYREF parameter you just have to change its value like you do in the following code.
When you use use BYREF a pointer to the actual memory address of the variable is passed into the function so any changes made to the parameter automatically get passed back out of the function.
You only need to use RETURN when the value is getting passed back through the function name. Meaning the calling statement looks like the following sample.
//Code here to set the 3 variables
svSQLPath = "C:\TEST";
svSQLBackupPath = "C:\Test\Backup";
svSQLDataPath = "C:\Test\Data";
When you use use BYREF a pointer to the actual memory address of the variable is passed into the function so any changes made to the parameter automatically get passed back out of the function.
You only need to use RETURN when the value is getting passed back through the function name. Meaning the calling statement looks like the following sample.
sSqlDir = GetSQLDir(sPath, sBackupPath, sDataPath)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 09, 2007
07:48 PM
Awesome!!! Thanks for that. All good now 🙂