Exploring, modeling, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Invoking Stored Process from Ipad

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

Invoking Stored Process from Ipad

Hi All ,

I don't know if this is a repeat question, i tried to search but couldn’t get anything relevant.

Requirement:

So here it goes, we have a SAS LASR analytic server and VA installed on windows machine. We want to give the end users the flexibility to choose values from the either drop down or type text from the front end and then process the request using customized code in SAS Stored process on the server and then render the report / graph back on the front end. We want this whole thing to be done on SAS VA and then port it to Ipad

Questions:

1) is it possible to process the request and the render the graph based on the output of stored process ,  I have seen stored process option in VA but don’t know how it works actually works

  2) How does it work on Ipad , if we write a stored process and integrate it with Ipad for front end, when user selects one of the many option or types customized text  from his Ipad, does the request actually goes to VA->then to Stored Process ->process request in server -> then back to VA -> then to Ipad ? Does this all happen in real time?

If above things cannot be done in VA is there a workaround for this kind of requirement to publish on Ipad?

Any inputs would be of great help. Any links or experiences from your previous or current implementation similar to the above Links to pdf for invoking STP from VA and Mobile.

Thanks for stopping by and reading the post.

Thanks

Keds    


Accepted Solutions
Solution
‎05-07-2014 09:51 AM
SAS Employee
Posts: 340

Re: Invoking Stored Process from Ipad

Hi Keds,

1. I made experiments only using the browser interface (not iPad).

2. Of course, when you create a VA report, source data must already exist and registered. The structure of the source table is fixed (no surprise I guess). So it makes sense only to update/delete existing rows, add new rows or maybe recreate the table with the same structure in this SP.

A very basic example (no parameter checks, no multi user support, not tested):

You should register a SP:  /MetaFolder1/ MetaFolder2/SP_Name with the following parameters:

seqNum default value=0

scale default value= <some number>

With this code (no %STPBEGIN; !  ):

%macro updateTableAndCreateForm ();

%let SeqNum=%eval(&SeqNum.+1);/*SeqNum contains how many times the user called the SP.*/

%if &SeqNum.>1 %then %do;

libname LASRLIB SASIOLA /*more options*/;

proc imstat data=LASRLIB.SOURCE_TABLE;

                update variable1=&scale.;

run;

quit;

%end;

data _null_;

file _webout;

put '<HTML>';

put "<H1>Report refreshed &SeqNum. times</H1>";

put "<FORM ACTION='&_URL'>";

put '<INPUT TYPE="hidden" NAME="_program"  VALUE="/MetaFolder1/ MetaFolder2/SP_Name">';

put 'scale parameter: <input type="text" name="scale" value="' "&scale." '"><br>';

put '<input type="hidden" name="SeqNum" value="' "&SeqNum." '"><br>';

put '<INPUT TYPE="submit" VALUE="RUN">';

put '</FORM>';

put '</HTML>';

run;

%mend;

%updateTableAndCreateForm;

Then create a VA report based on LASRLIB.SOURCE_TABLE table. I suggest to include varibale1 in the report, otherwise you don’t see changes made by the SP. Include the above SP in the report.

In my example the source table should already exist in LASR. I am only updating one column (variable1). And there are no calculation: I assign it a constant value. Use update / pgm=<fileref>; if you need a calculation.

You have no control which part of the report executes first (a bar chart or a SP). Therefore this SP skips the table update part, when a user views the report the first time.

The user can type a number, then click on the RUN button. Finally the user should refresh the report.

The user client (iPad/browser) should have IP connetivity to the SAS Stored Process Web Application (and also to VA).

View solution in original post


All Replies
Super User
Posts: 1,204

Re: Invoking Stored Process from Ipad

Hi Keds,

Thanks for providing details to your question.

Yes you can run a SAS Stored Process within a SAS Visual Analytics report. As you have found there is a Stored Process object that can be added to the report. For some information on the settings have a look at the user guide, SAS(R) Visual Analytics 6.4: User's Guide

When a report is subscribed to on the mobile device the report is rendered as it would be done in a browser as you expect.

Note that VA report styles are not used in your stored process.

Kind Regards,

Michelle

Trusted Advisor
Posts: 1,144

Re: Invoking Stored Process from Ipad

Hi Michelle,

I haven't played with VA at all yet (unfortunately!).  So to ask a follow up question: from this other thread:

https://communities.sas.com/thread/52582

my understanding was if you had VA call a Stored Process object, the stored process still executes on the stored process server or workspace server.  So you don't get all the benefits (speed) of the fancy LASR server in memory processing.

So for folks who use VA because they have huge data they want to crunch quickly, they'll need to be careful that any stored processes they incorporate are only asked to munch relatively small chunks of data, or else users might be surprised at how slow VA feels, without realizing that they are not actually using VA when they run a STP.

Sound right?

: If you plan to do all of the analysis/report generation with a stored process (rather than VA objects), then I would think you could make your stored processes iPad friendly without needing VA for the interface (e.g. stored process web app could be used).  If you search lexjansen.com, probably plenty of papers on delivering results to iPad/iPhone.

Thanks,

--Q.

Super User
Posts: 1,204

Re: Invoking Stored Process from Ipad

Hi Quentin,

Yes your understanding is correct. The stored process is executed on the workspace or stored process server. From my understanding of Keds question above that is what he wants to do. Developers/Analysts have the ability to execute custom code and use the prompt framework through stored processes in VA. I wouldn't imagine you would use a stored process to produce a chart/report on a LASR table as you would use the SAS Visual Analytic Report objects and controls for that.

WIth SAS Visual Analytics you get the benefit of building and deploying reports to the mobile device quickly and easily, analyzing large tables in memory as well as the flexibility to execute custom code via SAS stored processes as a report object. Keds has SAS VIsual Analytics already so I wouldn't suggest looking at the web app unless there is a specific need.

Kind Regards,

Michelle

Trusted Advisor
Posts: 1,144

Re: Invoking Stored Process from Ipad

Thanks Michelle,

So suppose you already have a report / appliction that runs via stored processes called from SPWA or WRS or wherever. 

Sounds like you see enough benefit to using VA as the User Interface / environment , that it would make sense to have this report generated through VA calling the stored process, rather than WRS or SPWA invoking the stored process.

That's good to know.  I would be happy to have some of the VA niceties on the front end to collect user input and still have my stored processes on the back end.  I've got a lead on a VA sandbox, so hopefully will be able to start playing with it soon!

-Q.

Contributor
Posts: 26

Re: Invoking Stored Process from Ipad

Hi Q and Michelle,

Thanks for your replies. as Q said , wanted something in the combination of Userdefined inputs in STP  , process the data in Hadoop and then render the report using VA. as we have a STP functionality in standard EBI where STP can be attached to Information Map and then can be used to render reports in WRS or IDP.

Was thinking of calling user defined STP with prompts and other things from VA which would process the data in Hadoop and then again create table or CUBE there and then use this Table/Cube to render the reports in VA.

Cheers

Keds

Super User
Posts: 1,204

Re: Invoking Stored Process from Ipad

HI Keds,

From your description above I am unclear whether you are wanting to produce a report with pure VA report objects or with a combination of SAS stored process objects. A stored process object in VA works the same as EBI and renders the results as a report object (a component) within a VA report, so there will be a mixed style in your VA report unless a style is designed for the stored process to match the VA style.

Note that to use the nice looking VA report objects e.g. Bar chart, bubble plot etc the underlying data source needs to be a table loaded into memory on the SAS LASR Server. I'm unsure what your expectation of VA report components to be and whether the stored process is for preprocessing or rendering a report at the same time.

Kind Regards,

Michelle

SAS Employee
Posts: 340

Re: Invoking Stored Process from Ipad

Hi Keds,

Yes, it is possible to create a (parameterized) stored process that updates data in LASR server. That data could be the input table of your report.

Also you can use techniques in a stored process that are fast even on Big Data: calling Hadoop stuff (as you mention), PROC IMSTAT, etc.

When you download a VA report to an iPad, only the initial results of the stored process (with default parameter settings) are downloaded. If you change the stored process parameters, you need to refresh the VA report.

You will need to use all your stored process writing skills. (For example: How to avoid, that stored process does not run again with default parameters, when you refresh the report?! How to deal with concurrent users?)

This might be usefull: SAS(R) 9.4 Stored Processes: Developer's Guide, Chaining Stored Processes

Contributor
Posts: 26

Re: Invoking Stored Process from Ipad

Hi Gergely ,

Thanks for the reply. you mentioned " stored process that updates data in LASR server" . do you have any references as how this can be done ?

Hope i am getting you correctly what you are saying :

Step 1 . Pull the data into LASR server

Step 2 . Use the stored Process to update or perform some logic on these input tables and create a output table in LASR itself.

Step 3. Use the output table created to render the graph using VA objects and functionality where all the VA functionality can be used.

can this happen ? do you have any reference for this ?

I wanted something like this :

1. Use the stored process from Mobile BI for prompts where user can input his choice

2. the choice made is pushed to Hadoop from SAS Stored Process

3. Where the processing happens in hadoop using native or through IMSTAT and create a table .

4. this table can used as input and then transferred to LASR .

5. VA can utilize this newly created LASR table to fully

Thanks

Keds

Solution
‎05-07-2014 09:51 AM
SAS Employee
Posts: 340

Re: Invoking Stored Process from Ipad

Hi Keds,

1. I made experiments only using the browser interface (not iPad).

2. Of course, when you create a VA report, source data must already exist and registered. The structure of the source table is fixed (no surprise I guess). So it makes sense only to update/delete existing rows, add new rows or maybe recreate the table with the same structure in this SP.

A very basic example (no parameter checks, no multi user support, not tested):

You should register a SP:  /MetaFolder1/ MetaFolder2/SP_Name with the following parameters:

seqNum default value=0

scale default value= <some number>

With this code (no %STPBEGIN; !  ):

%macro updateTableAndCreateForm ();

%let SeqNum=%eval(&SeqNum.+1);/*SeqNum contains how many times the user called the SP.*/

%if &SeqNum.>1 %then %do;

libname LASRLIB SASIOLA /*more options*/;

proc imstat data=LASRLIB.SOURCE_TABLE;

                update variable1=&scale.;

run;

quit;

%end;

data _null_;

file _webout;

put '<HTML>';

put "<H1>Report refreshed &SeqNum. times</H1>";

put "<FORM ACTION='&_URL'>";

put '<INPUT TYPE="hidden" NAME="_program"  VALUE="/MetaFolder1/ MetaFolder2/SP_Name">';

put 'scale parameter: <input type="text" name="scale" value="' "&scale." '"><br>';

put '<input type="hidden" name="SeqNum" value="' "&SeqNum." '"><br>';

put '<INPUT TYPE="submit" VALUE="RUN">';

put '</FORM>';

put '</HTML>';

run;

%mend;

%updateTableAndCreateForm;

Then create a VA report based on LASRLIB.SOURCE_TABLE table. I suggest to include varibale1 in the report, otherwise you don’t see changes made by the SP. Include the above SP in the report.

In my example the source table should already exist in LASR. I am only updating one column (variable1). And there are no calculation: I assign it a constant value. Use update / pgm=<fileref>; if you need a calculation.

You have no control which part of the report executes first (a bar chart or a SP). Therefore this SP skips the table update part, when a user views the report the first time.

The user can type a number, then click on the RUN button. Finally the user should refresh the report.

The user client (iPad/browser) should have IP connetivity to the SAS Stored Process Web Application (and also to VA).

Contributor
Posts: 26

Re: Invoking Stored Process from Ipad

Thanks Gregely   , Michelle and Quentin for all the help


Cheers

Keds

Contributor
Posts: 38

Re: Invoking Stored Process from Ipad

Hey,


i just tested Gregelys Solution with the Stored Process and _webout.

In the VA browser interface everything works fine, but on the iPAD no output is displayed.

I tested this already last year (6.2) and now with 6.4.

So maybe something is wrong with my configuration or this is a known problem?

Greetings from Germany

Marius

Sample Code :

data _null_;

file _webout;

put '<HTML>';

put 'My Test';

put '</HTML>';

run;

Output Browser :

Bildschirmfoto 2014-05-22 um 08.41.32.png

Output iPAD (6.4.1) :

Foto.PNG

Super User
Posts: 1,204

Re: Invoking Stored Process from Ipad

Hi Marius,

I'm not aware of any specific configuration required for 6.4. What I suggest doing is to check some log files to see what is happening with the transport service and whether the request is sent to the stored process server. Have you checked the SAS Stored Process log files to see if the request is being received and executed? This support note might also help with diagnosing the transport service...52874 - Capturing report diagnostics for SAS® Mobile BI

Kind Regards,

Michelle

Contributor
Posts: 38

Re: Invoking Stored Process from Ipad

Hi Michelle,

thanks for your response.

I enabled the Transport-Debug option.

After that I found the invoke of my Stored Process, in the cachedReport.xml


So i think the request is sent to the stored process server.


<cachedReportForPackage><cacheKey>i/A5B4RK15.B80000SR/cachedReport</cacheKey><dataLevel>interactive</dataLevel><date>2014-05-22T10:06:55.448+02:00</date><totalSize>15608</totalSize><urls><url type="report" name="report.xml" contentKey="UXRAVO6Z33C5YWAKY2CZX3QENWO2TGPL">report.xml</url><url type="xml" name="mediadefinition.xml" contentKey="PYVMDWNHSRKSIC4WO54YXME4ULGTIHXG">mediadefinition.xml</url><url type="css" name="basems1005.css" contentKey="U3J4RZD25TNJHXJNAEWPDSP3F3PCAU3J">css/basems1005.css</url><url usageVersion="2.0" type="stp" serverFile="SBIP://METASERVER/Shared Data/SAS Visual Analytics/Public/test(StoredProcess)" name="ve1001">/SASVisualAnalyticsTransport/onebi/services/ssoRedirect?url=http%3A%2F%2F********%2FSASStoredProcess%2Fdo%3F_action%3DEXECUTE%26_program%3DSBIP%253A%252F%252FMETASERVER%252FShared%2520Data%252FSAS%2520Visual%2520Analytics%252FPublic%252Ftest%2528StoredProcess%2529</url></urls></cachedReportForPackage>

Trusted Advisor
Posts: 1,144

Re: Invoking Stored Process from Ipad

Just a wild guess (I don't have VA).  As Michelle suggested, check the stored process server log to make sure the stored process actually ran.  Then any chance the ipad app works with package results, but the stored process is sending streaming results?

Post a Question
Discussion Stats
  • 21 replies
  • 1898 views
  • 3 likes
  • 6 in conversation