Download presentation
Presentation is loading. Please wait.
Published byBruno Stephens Modified over 9 years ago
1
SAS/AF® and Internet Explorer™ Richard A. DeVenezia
2
SAS/AF Full featured –Object orientated Very capable –lack latest developments Frames are input forms –Can host ActiveX components
3
Web pages Browsers use latest standards Cascading Style Sheets (CSS) Scripting Contain input forms –...
4
Why use a web page Designer pool Use of latest standards Development using production forms Interception –Flying under the radar
5
Internet Explorer Ever present in Windows systems ActiveX feature –Microsoft Web Browser component Voila! SAS/AF should be able to use Microsoft Web Browser
6
HTML Forms Inputs (parameters) transmitted to server –Name=Value pairs Tranmission types –GET pairs part of URL –POST pairs sent ‘behind the scenes’
7
ActiveX components Have methods Have properties Fire events –User of component can install event handler that gets invoked when an event is fired.
8
Microsoft Web Browser Navigate method –render page at URL BeforeNavigate2 event –gives access to component prior to actual transmission –Variables passed to handler URL (GET parameters) POST (buffer)
9
SAS/AF Frame Version 6 Objects –OLE - Insert Object Create Control Microsoft Web Browser –Insertable? (see SN-015762) Configure so BeforeNavigate2 runs MSBRWSEH.SCL
10
MSBRWSEH.SCL BN2: public method pDisp:num Url:char(1024) Flags:char(1024) TargetFrameName:char(1024) PostData:num Headers:num Cancel:num ; put 'BeforNavigate2 event handler'; put pDisp=; put Url=; put Flags=; put TargetFrameName=; put PostData=; put Headers=; put Cancel=; endmethod;
11
ERROR OLE: One of the parameters is not a valid type.
12
BeforeNavigate2 ByVal pDisp As Object, _ ByRef Url As Variant, _ ByRef Flags As Variant, _ ByRef TargetFrameName As Variant, _ ByRef PostData As Variant, _ ByRef Headers As Variant, _ ByRef Cancel As Boolean Variant corresponding to PostData can not be mapped to a SAS type, thus the ERROR
13
Now what? Microsoft Web Browser –Not directly useable Need an adapter –Mediate special type issues of ActiveX in SAS –Simple design for specific use
14
Adapter Design Navigate to a page Signal when new page is to be navigated to Retrieve GET and POST URL property OnBeforeNavigate event GetCount, GetName[index], GetValue[index] PostCount, PostName[index], PostValue[index]
15
OCX Development Borland Delphi 2006 Professional OleObjectForSasAf.ocx –Add form AfWebBrowser –Add properties and event –Delphi source at http://www.devenezia.com Install –regsvr32 OleObjectsForSasAf.ocx
16
Simple Frame AFBROWSER.FRAME –Contains only AfWebBrowser AFBRWSEH.SCL run by event map Caller passes in URL and SCL list to receive inputs Frame exits at first navigation attempt (i.e. submit button)
17
AFBROWSER.FRAME entry inUrl:input:char outParameters:update:List; init: declare Object oBrowser; _frame_._getWidget ('Browser', oBrowser); rc = setNitemL (oBrowser, {}, 'GET'); rc = setNitemL (oBrowser, {}, 'POST'); oBrowser._setProperty('URL', inURL); return;
18
AFBROWSER.FRAME Browser: browserCount + 1; if browserCount = 1 then return; if listlen (outParameters) >= 0 then do; get = getNitemL (oBrowser, 'GET'); post = getNitemL (oBrowser, 'POST'); rc = setNitemL (outParameters, get, 'GET'); rc = setNitemL (outParameters, post, 'POST'); end; * after capturing the data, shut down the browser frame; * callee is responsible for deleting the SCL lists it receives upon return; call execcmd ('CANCEL'); return;
19
AFBRWSEH.SCL OBN: public method; /* _self_ is an * OLE - Insert Object that contains an AfWebBrowser * presume _self_ already has two attached lists named * GET and POST, for storing the inputs */ Get = GetNitemL (_self_, 'GET', 1,1,0); Post = GetNitemL (_self_, 'POST', 1,1,0); rc = clearlist (Get); rc = clearlist (Post); declare char(200) name value ;
20
AFBRWSEH.SCL * Copy GET parameters to SCL list; _self_._getProperty('GetCount', count); do i = 1 to count; * Fetch pair from OLE object; _self_._getProperty('GetName', i-1, name); _self_._getProperty('GetValue', i-1, value); * Store pair in SCL list; rc = insertC (Get, value, -1, name); end;
21
AFBRWSEH.SCL * Copy POST parameters to SCL list; _self_._getProperty(’PostCount', count); do i = 1 to count; * Fetch pair from OLE object; _self_._getProperty('PostName', i-1, name); _self_._getProperty('PostValue', i-1, value); * Store pair in SCL list; rc = insertC (Post, value, -1, name); end; * force program flow through object label in frame SCL; _self_._objectLabel();
22
GetWebInput.scl Test Unit init: declare List input = {}; call display ( 'AFBROWSER.FRAME’, 'http://www.devenezia.com/papers/nesug-2006/Payments.html’, input ); call putlist (input,'',0); return;
23
Web Inputs to SAS Table Callable from Base Uses macro variables to pass parameters to SCL code –Code raise a window with the web form rendered via Microsoft Web Browser ensconced in Adapter. SCL code invoked using Proc DISPLAY
24
CaptureInput.scl init: declare List input = {}; call display ( 'AFBROWSER.FRAME', symget('CaptureUrl'), input );
25
CaptureInput.scl ds = open (symget('CapturedData'), 'N'); rc = newvar (ds, 'Type', 'C', 4); rc = newvar (ds, 'Name', 'C', 50); rc = newvar (ds, 'Value','C', 300); ds = close (ds); ds = open (symget('CapturedData'), 'U'); call PutVarC (ds,1,'URL'); call PutVarC (ds,2,''); call PutVarC (ds,3,symget('CaptureUrl')); rc = append (ds,'NOINIT');
26
CaptureInput.scl call PutVarC (ds,1,'GET'); list = GetNItemL (input,'GET',1,1,0); if list then do i = 1 to listlen(list); call PutVarC (ds,2,NameItem(list,i)); call PutVarC (ds,3,GetItemC(list,i)); rc = append (ds,'NOINIT'); end;
27
CaptureInput.scl call PutVarC (ds,1,'POST'); list = GetNItemL (input,'POST',1,1,0); if list then do i = 1 to listlen(list); call PutVarC (ds,2,NameItem(list,i)); call PutVarC (ds,3,GetItemC(list,i)); rc = append (ds,'NOINIT'); end; ds = close(ds); return;
28
Conclusion SAS/AF is alive and kicking –Has issues with variants ActiveX adapters can smooth integration Frame hosted web browser –Great tool for getting input
29
About the Author Richard A. DeVenezia Independent Consultant 9949 East Steuben Road Remsen, NY 13438 (315) 831-8802 richard.contact@devenezia http://www.devenezia.com/contact.php http://www.devenezia.com/papers/nesug-2006/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.