This is my first UDF. I wanted to display a list of variables (global, session & local) during the design and testing of an application. This function (aptly named Variables) lists all variables to help resolve confusion or to just satisfy curiosity.
I have placed it on the Form View System Toolbar, but it could equally be placed on a specific form.
'-----start UDF Variables
'Date Created: 11-Feb-2005 10:13:18 AM
'Last Updated: 11-Feb-2005 10:13:18 AM
'Created By : Dave Jampole
'Updated By : Dave Jampole
FUNCTION Variables AS C ( )
dim g as P
dim s as P
dim l as P
dim listg as C
dim lists as C
dim listl as C
dim to_showg as C
dim to_shows as C
dim to_showl as C
' get pointers to global, session & local variables
g = global_variables()
s = session_variables()
l = local_variables()
' build CR-LF delimited lists of global, session & local variables
listg = variables_enum(g)
lists = variables_enum(s)
listl = variables_enum(l)
' build lists containing variable name, type, and value
to_showg = *for_each(var, " "+var + "|" + typeof(eval(var)) + "|" + eval(var), listg)
to_shows = *for_each(var, " "+var + "|" + typeof(eval(var)) + "|" + eval(var), lists)
to_showl = *for_each(var, " "+var + "|" + typeof(eval(var)) + "|" + eval(var), listl)
' combines global, session & local variables into one list
to_show ="Global Variables"+CRLF()+to_showg+CRLF()+ "Session Variables"+CRLF()+to_shows+CRLF()+ "Local Variables"+CRLF()+to_showl+CRLF()
' show the list
ui_msg_box("Variables",to_show)
END FUNCTION
'-----end UDF Variables
If anyone sees how or where this can be improved, I'd appreciate it.
Dave
I have placed it on the Form View System Toolbar, but it could equally be placed on a specific form.
'-----start UDF Variables
'Date Created: 11-Feb-2005 10:13:18 AM
'Last Updated: 11-Feb-2005 10:13:18 AM
'Created By : Dave Jampole
'Updated By : Dave Jampole
FUNCTION Variables AS C ( )
dim g as P
dim s as P
dim l as P
dim listg as C
dim lists as C
dim listl as C
dim to_showg as C
dim to_shows as C
dim to_showl as C
' get pointers to global, session & local variables
g = global_variables()
s = session_variables()
l = local_variables()
' build CR-LF delimited lists of global, session & local variables
listg = variables_enum(g)
lists = variables_enum(s)
listl = variables_enum(l)
' build lists containing variable name, type, and value
to_showg = *for_each(var, " "+var + "|" + typeof(eval(var)) + "|" + eval(var), listg)
to_shows = *for_each(var, " "+var + "|" + typeof(eval(var)) + "|" + eval(var), lists)
to_showl = *for_each(var, " "+var + "|" + typeof(eval(var)) + "|" + eval(var), listl)
' combines global, session & local variables into one list
to_show ="Global Variables"+CRLF()+to_showg+CRLF()+ "Session Variables"+CRLF()+to_shows+CRLF()+ "Local Variables"+CRLF()+to_showl+CRLF()
' show the list
ui_msg_box("Variables",to_show)
END FUNCTION
'-----end UDF Variables
If anyone sees how or where this can be improved, I'd appreciate it.
Dave
Comment