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     dialogue manager and goto

Read-Only Read-Only Topic
Go
Search
Notify
Tools
dialogue manager and goto
 Login/Join
 
Platinum Member
posted
I'm doing the following looping (not all the code is here). The looping is working except when I try to create a graph and there is no data to graph. I display -TYPE &NOGRAPH;
-TYPE &CLOSEPDF;
-TYPE &RECORDS;
and the values are (nograph) Y (closepdf) Y and (records=) 0. So, when I do my check of -IF &RECORDS EQ 0 GOTO EMPTYRPT; it should go to emptyrpt but it's not going there. It's falling down into the code immediately below the if. If I only do 1 account that has no data it goes correctly to the emptyrpt. What am I doing wrong? Thanks.

-SET &COUNT = 1;
-REPEAT PDFLOOP WHILE &COUNT LE &NOOFACCTS;
SET PAGE-NUM=NOPAGE

-* CHECK THAT PERCENTAGE IS GE 1 SO THAT ONLY ITEMS ON GRAPH APPEAR IN LEGEND
SET LOOKGRAPH=PIE
SET 3D=OFF
GRAPH FILE HOLD220
SUM PCT_MKT_VL AS ""
BY SEC_GRP_NM
WHERE MKT_VL IS-NOT MISSING AND MKT_VL GT 0 AND PCT_MKT_VL GE 1
WHERE SORTORDER EQ &COUNT
ON GRAPH SET VAXIS 4
ON GRAPH SET HAXIS 6
ON GRAPH SET GRAPHSTYLE *
setFillColor(getSeries(0),new Color(0,0,255)); blue
ENDSTYLE
ON GRAPH SAVE AS ALLOC&COUNT FORMAT SVG
END

-* CHECK TO SEE IF A GRAPH WAS CREATED
-RUN
-SET &NOGRAPH=IF &RECORDS EQ 0 THEN ‘Y’ ELSE ‘N’;
-SET &CLOSEPDF=IF &RECORDS EQ 0 AND &COUNT EQ &NOOFACCTS THEN 'Y' ELSE 'N';
-SET &TITLE2 = IF &RECORDS EQ 0 THEN 'No Data Available For This Account' ELSE
- '-TYPE &NOGRAPH;
-TYPE &CLOSEPDF;
-TYPE &RECORDS;

-IF &RECORDS EQ 0 GOTO EMPTYRPT;
-* THE BELOW IS MODIFIED CODE TO GIVE THE IDEA OF WHAT I'M DOING.
TABLE FILE HOLD200
PRINT ACCOUNTID
-* CHECK IF IT'S THE LAST RECORD AND IF THERE IS NO GRAPH AND CLOSE
-* PDF FILE IF IT IS
-IF &COUNT GE &NOOFACCTS THEN GOTO CLOSEPDF;
ON TABLE PCHOLD FORMAT PDF
-GOTO PDFEND2
-CLOSEPDF
ON TABLE PCHOLD FORMAT PDF CLOSE
-PDFEND2
END

-EMPTYRPT
TABLE FILE HOLD200
PRINT ACCOUNTID
HEADING
"No Data to display"
-* CHECK IF IT'S THE LAST RECORD AND IF THERE IS NO GRAPH AND CLOSE
-* PDF FILE IF IT IS
-IF &COUNT GE &NOOFACCTS THEN GOTO CLOSEPDF2;
ON TABLE PCHOLD FORMAT PDF
-GOTO PDFEND
-CLOSEPDF2
ON TABLE PCHOLD FORMAT PDF CLOSE
-PDFEND
END


webfocus 8.105M; os: windows; pdf, html, exl2k, csv
 
Posts: 179 | Registered: November 10, 2004Report This Post
Silver Member
posted Hide Post
-TYPE lines shouldn't need a semi-colon to terminate them. I doubt it's solely reponsible, but you never know...

Paul.
 
Posts: 42 | Location: UK | Registered: October 23, 2005Report This Post
Platinum Member
posted Hide Post
I actually put the semi colons in because the code wasn't working and I thought maybe it wasn't reading the if statement


webfocus 8.105M; os: windows; pdf, html, exl2k, csv
 
Posts: 179 | Registered: November 10, 2004Report This Post
<Special-K>
posted
Not sure what's going on but instead of checking

-IF &RECORDS EQ 0 GOTO EMPTYRPT;

try

-IF &NOGRAPH EQ 'Y' GOTO EMPTYRPT;

as you know this has been set correctly.
 
Report This Post
<RickW>
posted
I'm assuming your already using -SET &ECHO=ALL; (or ON) to validate how it's working.

You might need to check &LINES instead of &RECORDS.

Is your value for &NOOFACCTS set correctly?

Instead of REPEAT you may need to use the old school method - something like...

-SET &CNTR = 0;
-STARTLOOP
-SET &CNTR = &CNTR +1;
-IF &CNTR GT &NOOFACCTS GOTO ENDLOOP;
TABLE FILE HOLD
PRINT BLAH BLAH BLAH
END
-RUN
-GOTO STARTLOOP
-ENDLOOP

Hope that helps.
 
Report This Post
Virtuoso
posted Hide Post
Several observations:

quote:
-REPEAT PDFLOOP WHILE &COUNT LE &NOOFACCTS;


1. I don't see the -PDFLOOP label in your posted code.


quote:

-* CHECK TO SEE IF A GRAPH WAS CREATED
-RUN
-SET &NOGRAPH=IF &RECORDS EQ 0 THEN ‘Y’ ELSE ‘N’;
...
-SET &TITLE2 = IF &RECORDS EQ 0 THEN 'No Data Available For This Account' ELSE
- '-TYPE &NOGRAPH;
...
-IF &RECORDS EQ 0 GOTO EMPTYRPT;


2. If there is any code whatsovever between the -RUN and the -IF &RECORDS (or &LINES) test, best practice is to set your own &var (such as your &NOGRAPH) and test that.

3. "-SET &TITLE2" has unbalanced quotes. Perhaps there's something interesting between the lines.

4. &RECORDS can give false positives if you have IF TOTAL tests; use &LINES instead.
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Platinum Member
posted Hide Post
I changed to use the following code after the graph:
-RUN
-SET &NOGRAPH=IF &LINES EQ 0 THEN ‘Y’ ELSE ‘N’;
-SET &CLOSEPDF=IF &LINES EQ 0 AND &COUNT EQ &NOOFACCTS THEN 'Y' ELSE 'N';

-TYPE &NOGRAPH
-TYPE &CLOSEPDF
-TYPE &RECORDS
-TYPE &LINES

I'm noticing the following are the results of my -type ... do you know why I would get ? around the Y? I think that may be problem. The ?y? is the result for &NOGRAPH.

?Y?
N
0
0


webfocus 8.105M; os: windows; pdf, html, exl2k, csv
 
Posts: 179 | Registered: November 10, 2004Report This Post
Expert
posted Hide Post
agreed.
use &LINES and save it IMMEDIATELY after your extract.
ON GRAPH SAVE AS ALLOC&COUNT FORMAT SVG
END
-RUN
-SET &HOWMANY = &LINES;

..now go ahead and type and check whatever you like. these &LINES vars get reset to 0 very easily, so make sure you grab it immediately.
as for the ?, in the code you copied, the marks around the Y and N in the first SET look different from the marks around the Y and N in the second SET; If your surround your code snippet with the code tags, we can see it better.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
the problem ended up being the quotes. The code must have been copied and they were not normal quotes on the set &nograph. Once I fixed the quotes the if statements appear to be working. More testing is needed but I think I have it. Thanks for the many helpful hints ... I didn't know that about &lines vs &records so that was helpful too.


webfocus 8.105M; os: windows; pdf, html, exl2k, csv
 
Posts: 179 | Registered: November 10, 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     dialogue manager and goto

Copyright © 1996-2020 Information Builders