A new Flexera Community experience is coming on November 25th, click here for more information.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Session.FormatRecord and VBScript

CChong
By Level 11 Flexeran
Level 11 Flexeran
Hello!

I'm a bit confused about the use of Session.FormatRecord. It seems to me that it is not well documented. I tried to use it to retrieve some properties, bu it doesn't seem to wrok. 😞
It this the correct way to use it?

set rcd = Installer.createrecord(3)
rcd.stringdata(0) = "[1] ... [2]"
rcd.stringdata(1) = "[#filename.ext]"
rcd.stringdata(2) = "[ProductName]"
session.FormatRecord(rcd)
msgbox rcd.stringdata(0)

Any ideas? Any link? Any documentation?
Thanks.
(3) Replies
You're right, it doesn't seem to be documented very well; I think the return value of FormatRecord is the formatted string. Something like this, perhaps (sorry, this is from memory):
[code]Set oRec = Installer.CreateRecord(2) ' field zero isn't included
oRec.StringData(0) = "Hello, [1] on [2]!"
oRec.StringData(1) = "[LogonUser]"
oRec.StringData(2) = "[ComputerName]"
strFormattedText = Session.FormatRecord(oRec)
MsgBox strFormattedText[/code]
CChong
By Level 11 Flexeran
Level 11 Flexeran
:confused: Puh...
Yes, it works. Thank you alot. By the way, check this link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/session_formatrecord.asp

In the official documentation, there is no return value for Session.FormatRecord. However, your example vorks very well. Strange...

Thanks.
Don't you love the way it says
The FormatRecord method of the Session object returns a formatted string from a template and record data.

followed by
This method has no return values.