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] Math requiring MOD

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Math requiring MOD
 Login/Join
 
Master
posted
I'm currently doing paging within my own HTML and based on the total amount of records I need to divide the page display count, then add 1 if it's not MOD page display count = 0 like in .NET.

Example:
Total Count: 80
Page Display Count: 10

I need this page count value to be 8.

Total Count: 81
Page Display Count: 10

I need this page count value to be 9.

This code needs to only do the plus one if datatotal MOD pagesize NE 0 as it would in .NET

-SET &PAGECOUNT = (&DATATOTAL/&PAGESIZE);
-SET &PAGECOUNT = (&PAGECOUNT+1);

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



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report This Post
Master
posted Hide Post
Try...
-SET &DATATOTAL = 81;
-SET &PAGESIZE = 10;

-SET &WORK = IMOD(&DATATOTAL, &PAGESIZE, 'I9');
-SET &WORK = IF &WORK EQ 0 THEN 0 ELSE 1;

-SET &PAGECOUNT = (&DATATOTAL/&PAGESIZE) + &WORK;

-TYPE DATATOTAL = &DATATOTAL
-TYPE PAGESIZE = &PAGESIZE
-TYPE PAGECOUNT = &PAGECOUNT  
 
Posts: 822 | Registered: April 23, 2003Report This Post
Master
posted Hide Post
Just one line of code needed ;-)


-SET &PAGECOUNT = INT ( ( &DATATOTAL + &PAGESIZE - 1 ) / &PAGESIZE );


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Platinum Member
posted Hide Post
I just wrote code last week to do what you're wanting to do - &URECS is the number of records in my hold file, I want 50 records per page. I create a variable '&REMAINDER' and check the value of &REMAINDER when creating my counter field - I then loop &TABCTR times creating a compound spreadsheet.

 

-SET &REMAINDER = IMOD(&URECS, 50, 'I3L');
-SET &TABCTR = IF &REMAINDER EQ 0 THEN (&URECS/50) ELSE ((&URECS/50) + 1);


Using your fields:
-SET &REMAINDER = IMOD(&DATATOTAL, 10, 'I3L');
-SET &PAGECOUNT = IF &REMAINDER EQ 0 THEN (&DATATOTAL/&PAGESIZE) ELSE ((&DATATOTAL/&PAGESIZE)+1);

&ECHO RESULTS WITH 80 RECORDS:
 -SET &DATATOTAL = 80;
 -SET &PAGESIZE = 10;
 -SET &REMAINDER = IMOD(80, 10, 'I3L');
 -SET &PAGECOUNT = IF 0 EQ 0 THEN (80/10) ELSE ((80/10)+1);
 -TYPE 0
 0
 -TYPE 8
 8
 -EXIT

&ECHO RESULTS WITH 81 RECORDS:
 -SET &DATATOTAL = 81;
 -SET &PAGESIZE = 10;
 -SET &REMAINDER = IMOD(81, 10, 'I3L');
 -SET &PAGECOUNT = IF 1 EQ 0 THEN (81/10) ELSE ((81/10)+1);
 -TYPE 1
 1
 -TYPE 9
 9
 -EXIT
 


 


WF 7.7.05
HP-UX - Reporting Server, Windows 2008 - Client, MSSQL 2008, FOCUS Databases, Flat Files
HTML, Excel, PDF
 
Posts: 149 | Location: Dallas, TX | Registered: June 08, 2007Report This Post
Master
posted Hide Post
quote:
-SET &WORK = IMOD(&DATATOTAL, &PAGESIZE, 'I9');
-SET &WORK = IF &WORK EQ 0 THEN 0 ELSE 1;

-SET &PAGECOUNT = (&DATATOTAL/&PAGESIZE) + &WORK;


Perfect! I couldn't find any MOD commands.. I think I have help file block syndrome.



- FOCUS Man, just FOCUS!
-----------------------------
Product: WebFOCUS
Version: 8.1.04
Server: Windows 2008 Server
 
Posts: 578 | Registered: October 01, 2014Report 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] Math requiring MOD

Copyright © 1996-2020 Information Builders