Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]User Define Function Library??

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]User Define Function Library??
 Login/Join
 
Member
posted
I wish to create user define functions and have them available to use/call in all procedures and InfoAssist reports in our environment. Creating the functions has not been an issue, sharing them is. The App Studio (8.1.05) online help describes a procedure to create a defined function library. I follow the procedure but never see the option to create a new Define Function Library. There's obviously a way to share user defined functions, but I find no reference in any documentation. Any help is appreciated.

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8
Windows, All Outputs
 
Posts: 4 | Registered: May 27, 2016Report This Post
Expert
posted Hide Post
We don't have v8.1.05 so I can't test this, but the documentation suggests this is done on the Data Servers area of the Explorer, not the Content area.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
That's it! Thanks so much, I'm a newbie so I must have missed that. Now to try to determine best practices...


WebFOCUS 8
Windows, All Outputs
 
Posts: 4 | Registered: May 27, 2016Report This Post
Expert
posted Hide Post
I will be talking about functions at Summit in Reno both from App Studio and InfoAssist GUIs (yes, you read that correctly Wink). If you're going, then my presentation is on Thursday 16th @ 2:45pm.

And yes, this has been an unashamed plug Razzer Wink

Hope to see many people there!

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: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Tony A:
And yes, this has been an unashamed plug Razzer Wink


You saved me the trouble of pointing out your shameless self promotion.


"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, 2004Report This Post
Member
posted Hide Post
Tony A, unfortunately I am unable to attend Summit. I hope you might share some of your presentation after Summit.


WebFOCUS 8
Windows, All Outputs
 
Posts: 4 | Registered: May 27, 2016Report This Post
Expert
posted Hide Post
quote:
shameless self promotion.

I knew that I could count on you to point it out so I pre-empted you!

quote:
I hope you might share some of your presentation after Summit.


I might work on an article once Summit is over and work levels reduce a little.

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: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Tony, did you ever get a chance to work on that article for User Defined Functions?


WebFOCUS 8
Windows, All Outputs
 
Posts: 5 | Registered: August 20, 2015Report This Post
Expert
posted Hide Post
Hi Brian,

Unfortunately no, I haven't had the time since Summit. It was muted at Summit that I do my presentation as an online webinar, but again, time and workload constraints preclude me from being able to identify when Frowner It is something that I will consider doing if the demand is there.

From a pure function exposure point of view, allowing both AS/DS and InfoAssist to consume those functions, I would develop within an App folder (as Francis points to above) and then include that library (basically a focexec) within the site profile.

In the meantime, this snippet of code is a variation on one of the examples from my presentation. It should be able to run on WF 7.7 (but not guaranteed Wink).

This is what it should look like -



T

DEFINE FUNCTION F_SINE DESCRIPTION 'Calculate the Sine of an Angle'
       (angle/D6.2 DESCRIPTION 'The angle in degrees')
 PI/D20.8  = 3.14159265358979;
 XVAL/D31.29 = angle / 180 * PI;
 XSQ/D31.29 = XVAL * XVAL ;
 RESID/D31.29 = XSQ * 0.5 ;
 COSIA/D31.29 = 1 - RESID ;
 RESIDA/D31.29 = XSQ * .0833333333333333 * RESID ;
 RESIDB/D31.29 = XSQ * .0333333333333333 * RESIDA ;
 RESIDC/D31.29 = XSQ * .0178571428571429 * RESIDB ;
 RESIDD/D31.29 = XSQ * .0111111111111111 * RESIDC ;
 RESIDE/D31.29 = XSQ * .00757575757575758 * RESIDD ;
 RESIDF/D31.29 = XSQ * .00549450549450550 * RESIDE ;
 RESIDG/D31.29 = XSQ * .00416666666666667 * RESIDF ;
 RESIDH/D31.29 = XSQ * .00326797385620915 * RESIDG ;
 RESIDI/D31.29 = XSQ * .00263157894736842 * RESIDH ;
 RESIDT/D31.29 = -RESIDI +RESIDH -RESIDG +RESIDF -RESIDE +RESIDD -RESIDC +RESIDB -RESIDA;
 COSIN/D31.25 = COSIA - RESIDT ;
 COSINS/D31.25 = COSIN * COSIN ;
 MULTI/D6 = IF angle LT 180 THEN 1 ELSE -1;
 F_SINE/P12.8 = MULTI * SQRT(1.0 - COSINS) ;
END

DEFINE FUNCTION F_COSINE DESCRIPTION 'Calculate the Cosine of an Angle'
       (angle/D6.2 DESCRIPTION 'The angle in degrees')
 PI/D20.8  = 3.141592;
 XVAL/D31.29 = angle / 180 * PI;
 XSQ/D31.29 = XVAL * XVAL ;
 RESID/D31.29 = XSQ * 0.5 ;
 COSIA/D31.29 = 1 - RESID ;
 RESIDA/D31.29 = XSQ * .0833333333333333 * RESID ;
 RESIDB/D31.29 = XSQ * .0333333333333333 * RESIDA ;
 RESIDC/D31.29 = XSQ * .0178571428571429 * RESIDB ;
 RESIDD/D31.29 = XSQ * .0111111111111111 * RESIDC ;
 RESIDE/D31.29 = XSQ * .00757575757575758 * RESIDD ;
 RESIDF/D31.29 = XSQ * .00549450549450550 * RESIDE ;
 RESIDG/D31.29 = XSQ * .00416666666666667 * RESIDF ;
 RESIDH/D31.29 = XSQ * .00326797385620915 * RESIDG ;
 RESIDI/D31.29 = XSQ * .00263157894736842 * RESIDH ;
 RESIDT/D31.29 = -RESIDI +RESIDH -RESIDG +RESIDF -RESIDE +RESIDD -RESIDC +RESIDB -RESIDA;
 COSIN/D31.25 = COSIA - RESIDT ;
 COSINS/D31.25 = COSIN * COSIN ;
 F_COSINE/P12.8 = COSIN ;
END

-* Div Width    is half the width of the resulting SVG canvas
-* Gauge Radius is the radius of the ring showing the percentage
-* Percentage   is the percentage required to be shown - acceptable values from 0 to 100 only
-* Colour       is the required colour of the ring. It can be any acceptable colour with maximum length 24 chars
-* Format          is the display format for the central value. Maximum 8 chars and should be D, F or P format otherwise 'D6%' is substituted.
-* Ok up to 99.617
DEFINE FUNCTION F_SVG_RING DESCRIPTION 'This function will return an A540 SVG collection for displaying simple outer ring around an inner opaque core'
      (Div_Width/I3    DESCRIPTION 'Half the width of the required SVG canvas',
       Gauge_Radius/I3 DESCRIPTION 'The radius of the "core" within the chart',
       Percent/D6.2    DESCRIPTION 'The percentage of the ring',
       Colour/A24      DESCRIPTION 'The required colour of the ring. It can be any acceptable colour with maximum length 24 chars',
       Format/A8       DESCRIPTION 'the display format for the central value. Maximum 8 chars and should be D F or P format otherwise "D6%" is substituted.')
  Percentage/D6.2 = IF Percent GT 100 OR Percent LT 0 THEN 0 ELSE Percent;
  Gauge_Radius/I3 = IF Gauge_Radius GT Div_Width THEN Div_Width ELSE Gauge_Radius;
  X_DIM/I6     = Div_Width * 2;
  Y_DIM/I6     = (Div_Width / 2) + (Div_Width / 8 * 5);
  Y_DIM1/I6    = Div_Width;
  X_DIM_A/A6   = LJUST(6,FPRINT(X_DIM,'I6','A6'),'A6');
  Y_DIM_A/A6   = LJUST(6,FPRINT(Y_DIM,'I6','A6'),'A6');
  Y_DIM1_A/A6  = LJUST(6,FPRINT(Y_DIM1,'I6','A6'),'A6');
  O_RAD/A3     = LJUST(3,FPRINT(Div_Width,'I3','A3'),'A3');
  I_RAD/A3     = LJUST(3,FPRINT(Gauge_Radius,'I3','A3'),'A3');
  B_RAD/A3     = LJUST(3,FPRINT(Gauge_Radius - 4,'I3','A3'),'A3');
  RAD_DIF/I2   = Div_Width - Gauge_Radius;
  RAD_DIF_A/A2 = LJUST(3,FPRINT(RAD_DIF,'I2','A2'),'A2');
  LAS/A1       = IF Percentage GE 50 THEN '1' ELSE '0';
  XCOORD/D6.2  = (Div_Width + Gauge_Radius * F_SINE(Percentage / 100 * 360));
  XCOORD_A/A10 = LJUST(10,FPRINT(XCOORD,'D6.2','A10'),'A10');
  YCOORD/D6.2  = X_DIM - (Div_Width + Gauge_Radius * F_COSINE(Percentage / 100 * 360));
  YCOORD_A/A10 = LJUST(10,FPRINT(YCOORD,'D6.2','A10'),'A10');
  PCENTG/A10   = LJUST(10,FPRINT(Percentage,Format,'A10'),'A10');

  F_Size/I6    = Gauge_Radius / 2;
  F_Size_A/A6  = LJUST(6,FPRINT(F_Size,'I6','A6'),'A6');
-* SVG PATH has a documented difficulty in displaying a circular angle GT 99.61%
-* So for these situations I always display a full circle as at these sizes it is adequate.
  F_SVG_RING/A500   = IF Percentage GE 99.61 THEN
                      '<svg width="'||X_DIM_A||'px" height="'||X_DIM_A||'px" version="1.1" xmlns="http://www.w3.org/2000/svg">'
                   || '<circle cx="'||O_RAD||'" cy="'||O_RAD||'" r="'||I_RAD||'" style="stroke:'||Colour||';stroke-width:5;fill:rgba(255,255,255,0.5);" />'
                   || '<circle cx="'||O_RAD||'" cy="'||O_RAD||'" r="'||B_RAD||'" style="stroke:#ccc;stroke-width:3;fill:rgba(255,255,255,0.8);" />'
                   || '<text x="'||Y_DIM1_A||'" y="'||Y_DIM_A||'" text-anchor="middle" style=";font-size:'||F_Size_A||'px;font-weight:700;fill:'||Colour||';">'||PCENTG||'</text>'
                   || '</svg>'
                 ELSE '<svg width="'||X_DIM_A||'px" height="'||X_DIM_A||'px" version="1.1" xmlns="http://www.w3.org/2000/svg">'
                   || '<path d="M'||(' '|O_RAD)||(' '|O_RAD)||('L '|O_RAD)||(' '|RAD_DIF_A)||(' A '|I_RAD)||(' '|I_RAD)||(' 0 '|LAS)||(' 1 '|XCOORD_A)||(' '|YCOORD_A)||' z" fill="'||Colour||'" style="stroke-width:1;stroke:rgba(255,255,255,0.5)" />'
                   || '<circle cx="'||O_RAD||'" cy="'||O_RAD||'" r="'||B_RAD||'" style="stroke:#ccc;stroke-width:3;fill:rgba(255,255,255,0.8);" />'
                   || '<text x="'||Y_DIM1_A||'" y="'||Y_DIM_A||'" text-anchor="middle" style="font-size:'||F_Size_A||'px;font-weight:700;fill:'||Colour||';">'||PCENTG||'</text>'
                   || '</svg>';
END

-* DIV          is the width of the resulting SVG canvas
-* Percent      is the percentage required to be shown - acceptable values from 0 to 100 only
-* Colour       is the required colour of the bar. It can be any acceptable colour with maximum length 24 chars
-* Format          is the display format for the central value. Maximum 8 chars and should be D, F or P format otherwise 'D6%' is substituted.
-* ALIGN        is the required alignment of the bar. Accepted values 'left' or 'right'.
DEFINE FUNCTION F_SVG_LINE_ALT DESCRIPTION 'This function will return an A250 SVG collection for displaying simple in-line bar charts with tooltips'
      (DIV/I3       DESCRIPTION 'The width of the required SVG canvas',
       Percent/D6.2 DESCRIPTION 'The percentage length of the bar',
       Colour/A24   DESCRIPTION 'The required colour of the ring. It can be any acceptable colour with maximum length 24 chars',
       Format/A8    DESCRIPTION 'the display format for the central value. Maximum 8 chars and should be D F or P format otherwise "D6%" is substituted.',
       ALIGN/A5     DESCRIPTION 'Required alignment. ''left'' or ''right'' only.')
  Percentage/D6.2 = IF Percent GT 100 THEN 100 ELSE IF Percent LT 0 THEN 0 ELSE Percent;
  X_DIM/A3    = LJUST(3,FPRINT(DIV,'I3','A3'),'A3');
  X1_DIM/A3   = IF ALIGN EQ 'right' THEN LJUST(3,FPRINT(DIV,'I3','A3'),'A3') ELSE '0';
  X2_DIM_C/D6.2 = IF ALIGN EQ 'right' THEN DIV - (DIV * Percentage / 100) ELSE DIV * Percentage / 100;
  X2_DIM/A8   = LJUST(6,FPRINT(X2_DIM_C,'D6.2','A8'),'A8');

  Format/A8 = IF Format EQ '' THEN 'D6%' ELSE IF NOT EDIT(Format,'9$') IN ('D','F','P') THEN 'D6%' ELSE Format;
  PCENTG/A10   = LJUST(10,FPRINT(Percent,Format,'A10'),'A10');
  F_SVG_LINE_ALT/A250 = '<svg width="'||X_DIM||'" height="12" version="1.1" xmlns="http://www.w3.org/2000/svg">'
                     || '<line x1="'||X1_DIM||'" y1="5" x2="'||X2_DIM||'" y2="5" style="stroke:'||Colour||';stroke-width:8;">'
                     || '<title>Value:'||(' '|PCENTG)||'</title></line>'
                     || '</svg>';
END
-RUN

DEFINE FILE GGSALES
  YEAR/YY = DATE;
  VALUE_1/D12.2 = IF YEAR EQ 1996 THEN DOLLARS / 10000 ELSE 0;
  VALUE_2/D12.2 = IF YEAR EQ 1997 THEN DOLLARS / 10000 ELSE 0;
END

TABLE FILE GGSALES
  SUM VALUE_1 NOPRINT
      VALUE_2 NOPRINT
  SUM VALUE_1 NOPRINT
      COMPUTE ROWSPAN/I1 = DECODE CATEGORY ('Coffee' 3 'Food' 3 ELSE 4); NOPRINT
      COMPUTE CAT_PCENT1/D6.2% = VALUE_1 / C1 * 100; NOPRINT
      COMPUTE RING_1/A650 = '</td><td rowspan='||EDIT(ROWSPAN)||'><div style="width:70px;height:60px;background-color:#fff;color:#000;font-size:18px;font-family:ArialMT,Arial;">'
                         || F_SVG_RING(30,28,CAT_PCENT1,'#c30','D6%')
                         || '</div>'; NOPRINT
      VALUE_2 NOPRINT
      COMPUTE CAT_PCENT2/D6.2% = VALUE_2 / C2 * 100; NOPRINT
      COMPUTE RING_2/A650 = '</td><td rowspan='||EDIT(ROWSPAN)||'><div style="width:70px;height:60px;background-color:#fff;color:#000;font-size:18px;font-family:ArialMT,Arial;">'
                         || F_SVG_RING(30,28,CAT_PCENT2,'#c30','D6%')
                         || '</div>'; NOPRINT
   BY CATEGORY NOPRINT
  SUM COMPUTE CNTR = LAST CNTR + 1; NOPRINT
      COMPUTE COLOUR/A7  = DECODE CNTR (1 '#ffbf47'
                                        2 '#f47738'
                                        3 '#d33880'
                                        4 '#912888'
                                        5 '#6f72af'
                                        6 '#005ea5'
                                        7 '#2e8aca'
                                        8 '#28a197'
                                        9 '#1abf22'
                                       10 '#1aff1a'
                                     ELSE '#bfc1c3'); NOPRINT
      VALUE_1 NOPRINT
      COMPUTE PCENT1/D6.2% = VALUE_1 / C3 * 100; NOPRINT
      COMPUTE BAR_1/A250 = F_SVG_LINE_ALT(100, PCENT1, COLOUR, 'D6.2%', 'right'); AS ''
      PCENT1  AS ''
      COMPUTE SHOW_R1/A1140 MISSING ON = IF CNTR IN (1,4,7) THEN RING_1 ELSE ''; AS ''
      PRODUCT AS ''
      COMPUTE SHOW_R2/A1140 MISSING ON = IF CNTR IN (1,4,7) THEN RING_2 ELSE ''; AS ''
      VALUE_2 NOPRINT
      COMPUTE PCENT2/D6.2% = VALUE_2 / C8 * 100; AS ''
      COMPUTE BAR_2/A250 = F_SVG_LINE_ALT(100, PCENT2, COLOUR, 'D6.2%', 'left'); AS ''
   BY CATEGORY NOPRINT
   BY PRODUCT NOPRINT
HEADING
"Percentage component by Category"
ON CATEGORY SUBHEAD
" "
"1996<CATEGORY<+0>1997"
ON TABLE SET STYLE *
  grid=off, size=9, font='Calibri', $
  type=heading, headalign=body, colspan=9, justify=center, style=+bold, size=12, $
  type=subhead, headalign=body, colspan=2, justify=center, $
  type=subhead, item=1, colspan=2, justify=right, size=10, $
  type=subhead, item=2, colspan=5, style=+bold, size=12, $
  type=subhead, item=3, colspan=2, justify=left, size=10, $
  type=data, column=C15, style=-bold, size=8, $
  type=data, column=C17, justify=center, style=+bold, size=10, $
  type=data, column=C20, style=-bold, size=8, $
ENDSTYLE
END
-RUN

This message has been edited. Last edited by: Tony A,



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: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]User Define Function Library??

Copyright © 1996-2020 Information Builders