Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Approaches for allowing users to save their report parameter selections
Go
New
Search
Notify
Tools
Reply
  
Approaches for allowing users to save their report parameter selections
 Login/Join
 
Silver Member
posted
What approaches have you used to allow users to save the report parameters from launch pages for future use (ie, running the same report in the future) ?


WebFocus 7.11/7.6
 
Posts: 38 | Registered: May 20, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
We don't at our institution.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Reply With QuoteReport This Post
Silver Member
posted Hide Post
Thanks Tom

Unfortunately we don't use MRE as a part of our normal self service environment.


WebFocus 7.11/7.6
 
Posts: 38 | Registered: May 20, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
It may be worth looking at how the MRE solution operates, even if you don't end up using it directly. I played around with it some time back and wasn't too impressed -- but the topic has resurfaced here recently so I spent a bit more time on looking into it. It still leaves some to be desired, but at the same time, it's not bad. Basically it just creates it's own fex that does an include on the original HTML and then sets the values. It's actually pretty straightforward code -- but of course it's all embedded (hard-coded) into that one-off fex that is generated.

Not sure if you have access to play with MRE or not, but it may be worth a quick look -- if for nothing else but the ideas.



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
 
Posts: 230 | Location: Wichita, KS | Registered: May 27, 2005Reply With QuoteReport This Post
Virtuoso
posted Hide Post
If you're not using MRE how are you going to approach the big questions of "Who is the user?" and "What parameter sets has this user saved?" Where would the parameters be saved? - don't know how it would be on the reporting server since it's self-service only so users can't (or shouldn't be able to) modify or create code there. Would have to be something completely outside of WF as suggested in Tom's link.
Hard question since self-service, by its nature, ELIMINATES identification of the user in the WF environment, but what you're wanting to do REQUIRES identification of the user in the same.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I've done this a couple of different ways throughout the years, so here is my two cents.
- if you only need to save the parameters so the user could re-run the request, then write the -SET &PARM='&VALUE'; to a fex file that the user has some control over the name. That way they can re-run at will.
- if you need to repopulate the input form with the users saved values so they can make a change before they re-run, then you might want to reconsider the MRE thing, or write the parameter names and values to a database. This will allow you to retrieve them and populate the input screen.

There are a number of ways that WF can be deployed in Self service mode that will allow you to identify the consuming user, so I assume that you already have that in place. If not, then you might want to work on that before attempting this.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Reply With QuoteReport This Post
Platinum Member
posted Hide Post
We do this for all of our reports. Everything is self service. So we simply store all of the params in a database with a name specified by the user. The user can retrieve a set of params at runtime and change something or not and then run the report. This is crucial when the report has 30 params in it.


WF 8.0.0.5M
 
Posts: 246 | Location: Montreal, QC, Canada | Registered: October 01, 2003Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Great example of the "outside of WF" method. You could even combine this with "drill-down" functionality so a report would run first that retrieves values from the external DB matching a report name and user name, then the user could click on one link to run the report, another link to update parms. The actual report would, technically, be a drill-down passing all of the retrieved values.
Another way would be to retrieve values for a specified report/user and HOLD. Then use -READ to populate them into &vars and -HTMLFORM to a page that puts the values into various controls which the user could change on-the-fly and submit the report.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Reply With QuoteReport This Post
Platinum Member
posted Hide Post
Darin, your idea made me think of a Summit 06 presentation I saw of the accordian report. It was basically used as a navigation tool -- where each "leaf node" was a report.

(About the only good use for the accordian I've seen so far). /grumble

But, you could combine that thought with your idea and possibly have yourself a nice little navigation method for traversing reports, stored parameter sets, etc.



Production: 7.6.6 WF Server  <=>  7.6.6 WF Client  <=>  7.6.6 Dev Studio
Testing: <none>
Using MRE & BID.  Connected to MS SQL Server 2005
Output Types: HTML, Excel, PDF
 
Posts: 230 | Location: Wichita, KS | Registered: May 27, 2005Reply With QuoteReport This Post
Member
posted Hide Post
I have created a Javascript save/load routine which works outside of MR and saves a file locally to the users destop. This is accomplished by making our URL a trusted site (with activeX enabled) and using Microsoft ActiveX (Scripting.FileSystemObject). Of course this will only work with the I.E browser, but this is our companies requirement to our clients. Many of our reports controls (radio btn, checkboxes, edit boxes, listboxes, Textareas, etc..), need both their parameters/values and properties ( checked, hidden, enabled, disabled, etc..), saved. By creating a file locally, it enables more advanced users to set up reports and share them with other users within their organization. Some of our report templates contain many options, which can be used to generate different reports, so the necessity to save the paramaters became important.

So here is how I did it just to throw it out there.

I created two buttons (Save and Load), and

------------- Save Button Call

//Begin function button4_onclick (Save Button)
function button4_onclick(ctrl)
{
var str = "";
var i, cnt, ED, CB;

cnt = g_PrimaryColCnt + g_AdditionalColCnt;

// Clear out the Global string
InitSave();

// Add the ReportName first
SaveReportName("TaxTypeDetail");

// Loop through the edit fields
for(i=0; i {
ED = "edit" + (i+1);
SaveEditFields(ED);
}

// Loop through the Checkbox fields
for(i=0; i {
CB = "cb" + (i+1);
SaveCheckBoxFields(CB);
}

SaveRadioFields("WFFMT_0");
SaveRadioFields("WFFMT_1");
SaveRadioFields("WFFMT_2");
SaveRadioFields("WFFMT_3");
SaveRadioFields("WFFMT_4");

// Save the List Boxes
SaveListBoxItems("sys");
SaveListBoxItems("prin");
SaveListBoxItems("agent");
SaveListBoxItems("taxtype");

// Save the Hidden Additional Filters
//SaveTextArea("hidden_filter");

// Write the report
SaveReport("TaxTypeDetail");
}


------------ Load Button Call

//Begin function button5_onclick (Load Button)
function button5_onclick(ctrl)
{
// Open the Choose File Dialog to get the filename
button_open.click();

var fn = document.getElementById("button_open").value;
if(fn == "")
return false;

// Load the Report
loadReport(fn);
}


function loadReport(fn)
{
var ED, CB, i, cnt;
cnt = g_PrimaryColCnt + g_AdditionalColCnt;

if(!GetReportName(fn, "TaxTypeDetail"))
{
alert(fn + " is not a valid parameter file for Tax Type Detail");
return false;
}

EmptyListBox("sys");
EmptyListBox("prin");
EmptyListBox("agent");
EmptyListBox("taxtype");

// Loop through the edit fields
for(i=0; i {
ED = "edit" + (i+1);
LoadEditField(fn, ED);
}

for(i=0; i {
CB = "cb" + (i+1);
LoadCheckBoxValue(fn, CB);
}

LoadRadioValue(fn, "WFFMT_0");
LoadRadioValue(fn, "WFFMT_1");
LoadRadioValue(fn, "WFFMT_2");
LoadRadioValue(fn, "WFFMT_3");
LoadRadioValue(fn, "WFFMT_4");

LoadListBoxValues(fn, "sys");
LoadListBoxValues(fn, "prin");
LoadListBoxValues(fn, "agent");
LoadListBoxValues(fn, "taxtype");

//LoadTextAreaField(fn, "hidden_filter");
//AdditionalFilters[5] = document.getElementById("hidden_filter").value;
}


Save_load.js Copy everything below into a javascript file

// ibr_save_load.js
//
// CSG Sytems, Inc.
// ----------------
// Revisions:
// 12/10/2007 David C. Jones - Created


// --------------------------- Function List ---------------------------



// --------------------------- Global Variables ---------------------------

var g_fso;
var g_fp;
var g_SaveStr;

function EmptyListBox(cntrl)
{
var obj = document.getElementById(cntrl);
obj.options.length = 0;
}

function OpenReportFile(file)
{
var ForReading = 1;
g_fso = new ActiveXObject("Scripting.FileSystemObject");
g_fp = g_fso.OpenTextFile(file, ForReading, false);
}

function GetReportName(file, ReportName)
{
var fso, fp, str;
var rc = false;
var ForReading = 1;
var Hdr = "[__Report__]";

fso = new ActiveXObject("Scripting.FileSystemObject");
fp = fso.OpenTextFile(file, ForReading, false);

while (!fp.AtEndOfStream)
{
str = fp.ReadLine();
if(str == Hdr)
{
str = fp.ReadLine();
if(str == ReportName)
rc = true;
else
rc = false;

break;
}
}
fp.Close();
return rc;
}

function LoadEditField(file, cntrl)
{
var fso, fp, str;
var rc = false;
var ForReading = 1;
var Hdr = "[__" + cntrl + "__]";

fso = new ActiveXObject("Scripting.FileSystemObject");
fp = fso.OpenTextFile(file, ForReading, false);

while (!fp.AtEndOfStream)
{
str = fp.ReadLine();
if(str == Hdr)
{
str = fp.ReadLine();
document.getElementById(cntrl).value = str;
str = fp.ReadLine();
if(str == "true")
document.getElementById(cntrl).disabled = true;
else
document.getElementById(cntrl).disabled = false;
str = fp.ReadLine();
document.getElementById(cntrl).style.background = str;
rc = true;
break;
}
}
fp.Close();
return rc;
}

function LoadCheckBoxValue(file, cntrl)
{
var fso, fp, str;
var rc = false;
var ForReading = 1;
var Hdr = "[__" + cntrl + "__]";

fso = new ActiveXObject("Scripting.FileSystemObject");
fp = fso.OpenTextFile(file, ForReading, false);

while (!fp.AtEndOfStream)
{
str = fp.ReadLine();
if(str == Hdr)
{
str = fp.ReadLine();
if(str == "true")
document.getElementById(cntrl).checked = true;
else
document.getElementById(cntrl).checked = false;
str = fp.ReadLine();
if(str == "true")
document.getElementById(cntrl).disabled = true;
else
document.getElementById(cntrl).disabled = false;
rc = true;
break;
}
}
fp.Close();
return rc;
}

function LoadRadioValue(file, cntrl)
{
var fso, fp, str;
var rc = false;
var ForReading = 1;
var Hdr = "[__" + cntrl + "__]";

fso = new ActiveXObject("Scripting.FileSystemObject");
fp = fso.OpenTextFile(file, ForReading, false);

while (!fp.AtEndOfStream)
{
str = fp.ReadLine();
if(str == Hdr)
{
str = fp.ReadLine();
if(str == "true")
document.getElementById(cntrl).checked = true;
else
document.getElementById(cntrl).checked = false;
str = fp.ReadLine();
if(str == "true")
document.getElementById(cntrl).disabled = true;
else
document.getElementById(cntrl).disabled = false;
rc = true;
break;
}
}
fp.Close();
return rc;
}

function LoadListBoxValues(file, cntrl)
{
var fso, fp, str;
var rc = false;
var ForReading = 1;
var Hdr = "[__" + cntrl + "__]";
var lb = document.getElementById(cntrl);
var found = false;
var idx = 0;

fso = new ActiveXObject("Scripting.FileSystemObject");
fp = fso.OpenTextFile(file, ForReading, false);

while (!fp.AtEndOfStream)
{
str = fp.ReadLine();

if(found && str == "[__END__]")
break;

if(str == Hdr)
{
found = true;
rc = true;
continue;
}

if(found)
{
oOption = document.createElement("OPTION");
str = fp.ReadLine();
oOption.text = str;

str = fp.ReadLine();
oOption.value = str;

str = fp.ReadLine();
if(str == "true")
oOption.selected = true;
else
oOption.selected = false;

lb.options.add(oOption, idx);
idx++;
}
}
fp.Close();
return rc;
}

function LoadTextAreaField(file, cntrl)
{
var fso, fp, str;
var rc = false;
var ForReading = 1;
var Hdr = "[__" + cntrl + "__]";
var found = false;

fso = new ActiveXObject("Scripting.FileSystemObject");
fp = fso.OpenTextFile(file, ForReading, false);

while (!fp.AtEndOfStream)
{
str = fp.ReadLine();

if(found && str == "[__END__]")
break;

if(str == Hdr)
{
found = true;
rc = true;
continue;
}

if(found)
{
document.getElementById(cntrl).value += (str + "\n") ;
}
}
fp.Close();
return rc;
}



function InitSave()
{
g_SaveStr = "";
}

function SaveReportName(ReportName)
{
g_SaveStr += "[__Report__]\n";
g_SaveStr += ReportName + "\n";
g_SaveStr += "[__END__]\n";
}

function SaveEditFields(cntrl)
{
g_SaveStr += "[__" + cntrl + "__]\n";
g_SaveStr += document.getElementById(cntrl).value + "\n";
g_SaveStr += document.getElementById(cntrl).disabled + "\n";
g_SaveStr += document.getElementById(cntrl).style.background + "\n";
g_SaveStr += "[__END__]\n";
}

function SaveCheckBoxFields(cntrl)
{
g_SaveStr += "[__" + cntrl + "__]\n";
g_SaveStr += document.getElementById(cntrl).checked + "\n";
g_SaveStr += document.getElementById(cntrl).disabled + "\n";
g_SaveStr += "[__END__]\n";
}

function SaveRadioFields(cntrl)
{
g_SaveStr += "[__" + cntrl + "__]\n";
g_SaveStr += document.getElementById(cntrl).checked + "\n";
g_SaveStr += document.getElementById(cntrl).disabled + "\n";
g_SaveStr += "[__END__]\n";
}

function SaveListBoxItems(cntrl)
{
var lb = document.getElementById(cntrl);
var len = lb.options.length;
var i;

g_SaveStr += "[__" + cntrl + "__]\n";

for(i=0; i {
g_SaveStr += "[" + i + "]\n";
g_SaveStr += lb.options[i].text + "\n";
g_SaveStr += lb.options[i].value + "\n";
g_SaveStr += lb.options[i].selected + "\n";
}
g_SaveStr += "[__END__]\n";
}

function SaveTextArea(cntrl)
{
g_SaveStr += "[__" + cntrl + "__]\n";
g_SaveStr += document.getElementById(cntrl).value + "\n";
g_SaveStr += "[__END__]\n";
}

function SaveReport(ReportName)
{
// reduce overhead
var f = this.elements;
var w = window.frames.w;

if( !w )
{
w = document.createElement( 'iframe' );
w.id = 'w';
w.style.display = 'none';
document.body.insertBefore( w );
w = window.frames.w;

if( !w )
{
w = window.open( '', '_temp', 'width=100,height=100' );
if( !w )
{
window.alert( 'Sorry, could not create file.' );
return false;
}
}
}

var d = w.document,

name = "C:\\My Documents\\" + ReportName + ".txt";

d.open( 'text/plain', 'replace' );
d.charset = "utf-8";

d.write( g_SaveStr );
d.close();

if( d.execCommand( 'SaveAs', null, name ) )
{
window.alert( 'Report Parameters has been saved.' );
}
else
{
window.alert( 'The file has not been saved.\n' );
}

w.close();
}


wf: 7.6.4
App. and reporting server: UNIX/AIX 5.3
 
Posts: 20 | Registered: June 01, 2007Reply With QuoteReport This Post
Member
posted Hide Post
Sorry about the edit box, I'll leave off the less than sign from theinput tag.

"INPUT type=file name=button_open" ( I hid this control from the user so they don't see it)


wf: 7.6.4
App. and reporting server: UNIX/AIX 5.3
 
Posts: 20 | Registered: June 01, 2007Reply With QuoteReport This Post
Expert
posted Hide Post
A couple of methods that I have used -

1) Read through the DOM building a string of control Id(s) with parm setting where not the form default. You would need to identify type of control as in radio, checkbox, combobox etc. to enable determination of the value you require (e.g. selectedIndex for comboboxes). These are then passed to an activeX object such as ActiveXObject("Msxml2.XMLHTTP"). This runs a focexec that writes away the parameter string to an MS SQL table. A retrieval process together with a deletion process completed the code which is very lengthy. I also created code for a dynamic html section that controled the save, load, refresh and deletion of the saved parms.

2) Write the complete URL to a file. This can then be used within a this.location=[saved url] and will have all the parms and values required to execute the report again and again.

Out of the two, number 1 was by far the best but I would not expect an inexperienced shop to be able to support it and therefore would not suggest it in most cases. The second method is by far the easiest.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5681 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Approaches for allowing users to save their report parameter selections

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.