Focal Point
Read Windows Environment Variable value

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8751083822

May 17, 2007, 09:17 AM
Francis Mariani
Read Windows Environment Variable value
Is there a method of getting Windows environment variable values into Dialogue Manager variables?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 17, 2007, 09:30 AM
Alan B
The only way I know, and there must be a better one, is to use:

DOS SET > c:\settings.txt

and read the file with DM, picking out the ones you want.

You can also use
DOS SET name > c:\settings.txt
e.g.
DOS SET TEMP > c:\settings.txt
to pick up certain items.


Alan.
WF 7.705/8.007
May 17, 2007, 09:53 AM
Francis Mariani
Alan B,

DOS SET > c:\settings.txt works for me. Thanks.

Interestingly, when SET is executed from a Windows CMD window, any existing User variables override the System environment variables. When SET is executed from WebFOCUS, the variables are the System variables with no override.

As well, attempting to retrieve one system variable with the command DOS SET TEMP > c:\settings.txt does not work on my Win XP PC.

Thank you.

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 17, 2007, 10:27 AM
Alan B
Francis

I believe that's me being optimistic. I forgot that to do a DOS SET TEMP > c:xxx.xxx requires the extended command processor, probably not available in WF. I think it was doable in PC/Focus!


Alan.
WF 7.705/8.007
May 17, 2007, 10:34 AM
Francis Mariani
Alan,

The normal DOS SET command works for me. This is the fex code I used to isolate the TEMP variable:

-L1_WINNT
-*-- Determine Temp file path for Windows ------------------

DOS SET > c:\settings.txt
-RUN

FILEDEF SETTINGS DISK c:\settings.txt
-RUN

-*-- Read variable length data ---
-READ SETTINGS, &DATA

-REPEAT L1E1_WINNT WHILE &IORETURN EQ 0;

-IF &DATA CONTAINS 'TEMP=' GOTO L1E2_WINNT;

-*-- Read variable length data ---
-READ SETTINGS, &DATA

-L1E1_WINNT
-SET &FILE_PATH = 'C:\webfocus_data';
-GOTO L1E3_WINNT

-L1E2_WINNT
-SET &TEMP_PATH = GETTOK(&DATA, &DATA.LENGTH, 2, '=', 200, 'A200');
-SET &FILE_PATH = &TEMP_PATH || '\webfocus_data';
-GOTO L1E3_WINNT

-L1E3_WINNT
-SET &MKDIR_CMD = 'DOS mkdir '     | &FILE_PATH;
&MKDIR_CMD
-RUN

Cheers.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 17, 2007, 10:59 AM
TexasStingray
The FGETENV function retrieves the value of an environment variable and returns it as an alphanumeric string.




Scott

-SET &TEMPDIR = FGETENV(4, 'TEMP', 200, 'A200');
-TYPE &TEMPDIR

Wonderful! Thanks, TexasStingray.

(2009/02/11 - modified the code: incorrectly coded the out-field-format as 'A' instead of 'A200'. Code tightening in v7.6 caused the FGETENV function to not return the correct TEMP directory. It should work now).

This message has been edited. Last edited by: Francis Mariani,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Knew there had to be a better way, the other is a bit of a kluge.


Alan.
WF 7.705/8.007
are these variable the the ones from the enduser or from the server?
I must give this a try next week, this would give me some nice opportunities.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

Server environment settings.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server