View Full Version : Cannot Write (table value) to Log File

01-29-2005, 07:47 AM
When trying to write information to a log file I receive the following message

"Attempt to call global 'user_info' (a table value)"

user_info = System.GetUserInfo();
SetupData.WriteToLogFile("Computer USERinfo: ",user_info"\r\n",true);

I have also tried

SetupData.WriteToLogFile("Computer USERinfo: ",System.GetUserInfo()"\r\n",true);

I also have another area with the same problem

SetupData.WriteToLogFile("UserName: ",CTRL_EDIT_01"\r\n",true);
SetupData.WriteToLogFile("UserCompany: ",CTRL_EDIT_02"\r\n",true);

Please Help

Ted Sullivan
01-29-2005, 08:58 AM
Take a look at the Setup Factory 7.0 Help File (http://www.indigorose.com/webhelp/suf70/index.htm
) for the full syntax and examples, but the problem is that System.GetUserInfo (http://www.indigorose.com/webhelp/suf70/Program_Reference/Actions/System.GetUserInfo.htm) returns a table of information, rather than a single value.

table System.GetUserInfo ()


-- Checks to see if the current user is logged in with administrator permissions
-- and if they are not, displays a dialog box informing them.
user_info = System.GetUserInfo();
if (not user_info.IsAdmin) then
Dialog.Message("Warning", "You are not logged in with the appropriate permissions.");

In this example, the registered user and organization could be accessed by referencing user_info.RegOwner and user_info.RegOrganization.

02-06-2005, 06:36 PM
I was able to get the user input to write to logs file but not able to get a table to to write to the logs. Below is the code I used for the user input screens

sMessage="UserName: "..sUserName.."\r\n";
SetupData.WriteToLogFile(sMessage, true);

sUserCompany = SessionVar.Expand("%UserCompany%");
sMessage = "UserCompany: "..sUserCompany.."\r\n";
SetupData.WriteToLogFile(sMessage, true);

I still would like to get system.getlaninfo to write to the same log file.

02-06-2005, 11:19 PM
still would like to get system.getlaninfo to write to the same log file.
If you want to log the IP:

tLAN = System.GetLANInfo();
SetupData.WriteToLogFile("IP: "..tLAN.IP.."\r\n", true);

If you want to log all the information in the table:

for index, data in tLAN do
SetupData.WriteToLogFile(index..": "..data.."\r\n", false);
(false = without the time stamp.)

The table feature is powerful, but at first glance it seems to be difficult. I recommend the SpeedyTraining CD #3 (or; at least; the free online video at http://www.speedytraining.com).

Don't forget: There's a lot of action scripting stuff in the AMS50 forum.

Good luck! :)