Focal Point
[CLOSED] Dynamically create menu page with links

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

March 31, 2011, 11:50 AM
mpbMDE
[CLOSED] Dynamically create menu page with links
Hi all,
I need to create a menu page with links to run any one of a list of reports. No problem. But I need to list only reports that a user is authorized to view. I was going to create a large listbox, populated dynamically with only the authorized reports. But this is not satisfactory. The request is for a page with links to only the users authorized reports and no empty spaces. ex:
report1link
report2link
report3link
I have the list of authorized reports..It just dynamically building the page where I am left in the dark. (I am not an html or javascript programmer.) Any help would be much appreciated.
Marilyn

This message has been edited. Last edited by: mpbMDE,


WebFOCUS 8.1.05 Windows 7, all output
March 31, 2011, 03:40 PM
Waz
As long as you know the user that is logged in, and the list has the fex and user in it, then its just a report.

You could then have a drilldown to each report, or if logged into MRE, submit the report deferred, etc.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 01, 2011, 07:25 PM
OPALTOSH
Marilyn,
I do this by generating personal HTML menus for each individual user that only contain the reports that the user is allowed to run.

When they login (authenticate) their personal menu gets displayed with all the appropriate links to reports and/or parameter pages etc.

The HTML pages are created using FOCUS code primarily.
April 02, 2011, 10:52 AM
George Patton
I have a similar issue to deal with. Not only do I need to show only cetain report options to certain groups of users, but I need to authenticate each user such that report parameters are individualised.

For example, we have 5 sales managers. The boss wants to permit each of them to run the report that shows the sales for their own territory only, not all territories. However, he wants to be able to run the report for all territories himself. I'm guessing this is a perfect place for Managed Reporting, but we don't own that module (and aren't likely to get it).

Another wrinkle is that in a small company like ours (30 people total) it's only a matter of time before everyone knows everyone else's login credentials, so I'm wrestling with the notion of some kind of randomized password that could be generated by Report Caster and e-mailed to each user on a daily basis and be good for only that day. Somehow I would have to incorporate an amper variable into each report that would recognise the password and thereby produce output tailored to the specific user.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
April 03, 2011, 04:39 AM
OPALTOSH
George,
Surely the issue of login credentials being shared is an IT issue not a business issue.

In any case storing each users access rights for different reports is easy. I have a self service application that does this as well as creating personalised menus for each user.

What you are suggesting is possible. Getting it emailed to each user is a bit of an issue though.
April 03, 2011, 10:33 PM
OPALTOSH
If you want further details then send me a PM at gpotter@opalibusiness.com.au
April 04, 2011, 04:34 AM
<FreSte>
Hello,

Let's say the list of authorized reports looks like USERDATA (see below), then you could (like Waz suggested)
run a report that generates the links to the reports.
This is a very basic example, but you'll get the point (change the DEFAULTS to meet your configuration).

Cheers,

-Fred-

PS: You can run this report like (lets say you've saved this code as FEXLIST in baseapp):

http://localhost:8080/ibi_apps/WFServlet?IBIF_ex=FEXLIST&USERID={1,2,3}


-* --- FILEDEF's to MASTER and DATA
FILEDEF MASFILE   DISK  userdata.mas
FILEDEF USERDATA  DISK  userdata.ftm
-RUN

-* --- Write MASTER-file
-WRITE MASFILE FILENAME=USERDATA, SUFFIX=FIX  ,$
-WRITE MASFILE   SEGMENT=USERDATA, SEGTYPE=S2, $
-WRITE MASFILE     FIELDNAME=USERID     ,ALIAS=E01 ,USAGE=I5    ,ACTUAL=A05, $
-WRITE MASFILE     FIELDNAME=USERNAME   ,ALIAS=E02 ,USAGE=A15   ,ACTUAL=A15, $
-WRITE MASFILE     FIELDNAME=FEXNAME    ,ALIAS=E03 ,USAGE=A15   ,ACTUAL=A15, $
-WRITE MASFILE     FIELDNAME=REPORTNAME ,ALIAS=E04 ,USAGE=A20   ,ACTUAL=A20, $

-* --- Write DATA-file
-WRITE USERDATA     1Username 1     fexname_01     Sales by region
-WRITE USERDATA     1Username 1     fexname_02     Sales by product
-WRITE USERDATA     1Username 1     fexname_03     Sales by salesrep
-WRITE USERDATA     2Username 2     fexname_01     Sales by region
-WRITE USERDATA     2Username 2     fexname_03     Sales by salesrep
-WRITE USERDATA     3Username 3     fexname_02     Sales by product

-* --- Some defaults
-DEFAULT &PATH    = '/ibi_apps/WFServlet'
-DEFAULT &IBI_EX  = '?IBIF_ex='
-DEFAULT &USERID  = 1


-* --- Generate FEX-list
TABLE FILE USERDATA
HEADING
"Reports for : <USERNAME"
" "
  PRINT
    COMPUTE LINE/A200 =
      '<a href="&PATH|&IBI_EX' || FEXNAME || '&|USERID=&USERID">' || REPORTNAME || '</a>'; AS ''
  WHERE USERID EQ &USERID ;
  ON TABLE SET PAGE NOPAGE
  ON TABLE SET STYLE *
  TYPE=REPORT, GRID=OFF ,$
END
-RUN

April 06, 2011, 08:55 AM
George Patton
Gents:

Thanks for the suggestions. I'll be following up in the next couple of weeks. Note that having access to certain reports is only half the problem. The second half is restricting the output of a given report according to the user ID (which I would like to be able to change on a regular basis).

So, for example: We have 5 sales managers.
We have a monthly sales report. Right now, I have to run the report 5 times - once for each manager - save as PDF and then e-mail to each one individually. Why? Because the boss does not want any manager to know how the other guy is doing: they just get jealous and start bickering.

I would like each sales manager to be able to run the same monthly sales report - but view ONLY the results for his sales area. We will accomplish part of this with bursting of scheduled reports by ReportCaster, but there will always remain the requirement for manual report selection.

Our managers are identified by their initials and it's easy to build a territory list for each on that basis, so in theory all we have to do is ask each one to provide his initials as a parameter for the report. But there is no way to stop manager 'AM' from putting in 'CB' to produce the report for another sales territory unless I introduce a password system. And that opens the can of worms, because I will need to change that password regularly and have it dynamically authenticate the user on not just one report, but a whole variety.

Of course I could reproduce and hard-code the same report 5 times - one for each manager and give him his own menu - but multiply that by 15 reports and life starts to get very messy... And after the 5 managers we come to the 5 customer service reps, where the situation is similar.

All of this in a company with only 30 employees and an IT department of 1 - that would be me.

George


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
April 06, 2011, 01:00 PM
rfbowley
I would suggest investigating the use of Named Filters. It is kind of 'old school' but is what I used in a similar situation for a client a few years back. Here is a link to one of the IBI documents on the subject:

http://documentation.informati...f_create73/sel12.htm


Robert F. Bowley Jr.
Owner
TaRa Solutions, LLC

In WebFOCUS since 2001
April 06, 2011, 02:25 PM
<FreSte>
And I would suggest distributing these reports by ReportCASTER. You determine who is getting what when and how.
Everybody happy (I guess Smiler )

-Fred-
April 06, 2011, 03:10 PM
FrankDutch
You can use the login id of the user and combine that in the reports to select the proper manager.
This also can be used in the reportcaster bursting facility.




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

April 11, 2011, 06:14 PM
mpbMDE
I don't want to have to create a menu for each user. That's the point of doing it dynamically.

Any suggestions?


WebFOCUS 8.1.05 Windows 7, all output
April 12, 2011, 08:47 AM
OPALTOSH
The way I have done it could be done dynamically if you really want to do that.
But it's not required in my system. Any time there is a change to a users menu it cretes a new one instantly.
April 13, 2011, 08:13 AM
<FreSte>
quote:
I don't want to have to create a menu for each user. That's the point of doing it dynamically


If all is database driven, the menu's are generated for you.
So this is the only way to go for. It's then all done dynamically.
April 13, 2011, 10:05 AM
mpbMDE
I don't get what you are saying. Can you say it another way?
It is not database driven...


WebFOCUS 8.1.05 Windows 7, all output
April 13, 2011, 04:39 PM
<FreSte>
I was trying to say that you should make it database driven. It will make it for you much easier
to maintain and you don't have to write for each user a personalized page with report links.
The fex will do that for you.

Below you'll find another (basic) example with how things could be done.
The example has 3 FOCUS-databases:

USERS
REPORTS
USRREP (connecting users and reports)

If you change the &USERID, the page will be personalized for that user.


Hope things are more clear now.

Cheers,

-Fred-


-* ------------------------------------------------------------------------------------------------
-* MASTER-file for USER-data
-* ------------------------------------------------------------------------------------------------
FILEDEF MASFILE   DISK  users.mas
-RUN
-WRITE MASFILE FILENAME=USERS, SUFFIX=FOC  ,$
-WRITE MASFILE   SEGMENT=SEG01, SEGTYPE=S1, $
-WRITE MASFILE     FIELDNAME=USERID   ,ALIAS=E01 ,USAGE=I5    ,ACTUAL=I5  ,$
-WRITE MASFILE     FIELDNAME=USERNAME ,ALIAS=E02 ,USAGE=A20   ,ACTUAL=A20 ,$

-* --- Add user data
CREATE FILE USERS
MODIFY FILE USERS
  FREEFORM USERID USERNAME
    MATCH USERID
      ON MATCH UPDATE *
      ON NOMATCH INCLUDE
  DATA
    1 ,'Username 1'  ,$
    2 ,'Username 2'  ,$
END
-RUN


-* ------------------------------------------------------------------------------------------------
-* MASTER-file for REPORT-data
-* ------------------------------------------------------------------------------------------------
FILEDEF MASFILE   DISK  reports.mas
-RUN
-WRITE MASFILE FILENAME=REPORTS, SUFFIX=FOC  ,$
-WRITE MASFILE   SEGMENT=SEG01, SEGTYPE=S1, $
-WRITE MASFILE     FIELDNAME=REPORTID    ,ALIAS=E01 ,USAGE=I5    ,ACTUAL=I5  ,INDEX=I ,$
-WRITE MASFILE     FIELDNAME=REPORTNAME  ,ALIAS=E02 ,USAGE=A30   ,ACTUAL=A30 ,$
-WRITE MASFILE     FIELDNAME=FEXNAME     ,ALIAS=E03 ,USAGE=A30   ,ACTUAL=A30 ,$

-* --- Add report data
CREATE FILE REPORTS
MODIFY FILE REPORTS
  FREEFORM REPORTID REPORTNAME FEXNAME
    MATCH REPORTID
      ON MATCH UPDATE *
      ON NOMATCH INCLUDE
  DATA
    1 ,'Sales by region'             ,'sales_by_region'          ,$
    2 ,'Sales by product'            ,'sales_by_product'         ,$
    3 ,'Sales by month by customer'  ,'sales_by_month_customer'  ,$
    4 ,'Sales by month by year'      ,'sales_by_month_year'      ,$
END
-RUN


-* ------------------------------------------------------------------------------------------------
-* MASTER-file for USER_REPORT data
-* ------------------------------------------------------------------------------------------------
FILEDEF MASFILE   DISK  usrrep.mas
-RUN
-WRITE MASFILE FILENAME=USRREP, SUFFIX=FOC  ,$
-WRITE MASFILE   SEGMENT=SEG01, SEGTYPE=S2, $
-WRITE MASFILE     FIELDNAME=USERID    ,ALIAS=E01 ,USAGE=I5    ,ACTUAL=I5  ,INDEX=I ,$
-WRITE MASFILE     FIELDNAME=REPORTID  ,ALIAS=E02 ,USAGE=I5    ,ACTUAL=I5  ,INDEX=I ,$

-* --- Add report data
CREATE FILE USRREP
MODIFY FILE USRREP
  FREEFORM USERID REPORTID
    MATCH USERID REPORTID
      ON MATCH UPDATE *
      ON NOMATCH INCLUDE
  DATA
    1 ,1 ,$
    1 ,2 ,$
    1 ,3 ,$
    2 ,1 ,$
    2 ,4 ,$
END
-RUN


-* --- Generate database-driven personalized page with report links
JOIN USERID   IN USERS TO ALL USERID   IN USRREP  AS J1
JOIN REPORTID IN USERS TO ALL REPORTID IN REPORTS AS J2


-* --- Some defaults
-DEFAULT &PATH    = '/ibi_apps/WFServlet'
-DEFAULT &IBI_EX  = '?IBIF_ex='
-DEFAULT &USERID  = 1


-* --- Generate FEX-list
TABLE FILE USERS
HEADING
"Reports for : <USERNAME"
" "
  PRINT
    COMPUTE LINE/A200 =
      '<a href="&PATH|&IBI_EX' || FEXNAME || '&|USERID=&USERID">' || REPORTNAME || '</a>'; AS ''
  WHERE USERID EQ &USERID ;
  ON TABLE SET PAGE NOPAGE
  ON TABLE SET STYLE *
  TYPE=REPORT, GRID=OFF ,$
END
-RUN

April 13, 2011, 04:53 PM
mpbMDE
Thank you FreSte!


WebFOCUS 8.1.05 Windows 7, all output