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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
&RECORDS question
 Login/Join
 
Gold member
posted
Hi,
I have a Table file that I am using the &records of it to set it as &TOTAL. I am using that &TOTAL in my report but it does not seem to be working. This is how my table looks like:

TABLE FILE TEST
PRINT COURSE
BY TERM
IF COURSE NE LAST COURSE
ON TABLE HOLD AS TESTCRS
END
-RUN
-SET &TOTAL = &RECORDS;

TABLE FILE TESTCRS
PRINT TERM COURSE
ON TABLE SUBFOOT
" "
"Total Number of Courses: &TOTAL"
" "
END

How can I make this work so that I can keep this format in the report? Thanks for your help in advance!


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
<RickW>
posted
>>> IF COURSE NE LAST COURSE <<<

try WHERE

Other than that the code looks OK.
 
Report This Post
Gold member
posted Hide Post
Hi, Thanks but
IF or WHERE is not the case here though. The &total is the problem, it does not work...


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
<RickW>
posted
worky

TABLE FILE CAR
PRINT MODEL
BY CAR
WHERE MODEL NE LAST MODEL
ON TABLE HOLD
END
-RUN
-SET &TOTAL=&RECORDS;
TABLE FILE HOLD
PRINT CAR MODEL
ON TABLE SUBFOOT
"&TOTAL"
END
-------------------------------
no worky

TABLE FILE CAR
PRINT MODEL
BY CAR
IF MODEL NE LAST MODEL
ON TABLE HOLD
END
-RUN
-SET &TOTAL=&RECORDS;
TABLE FILE HOLD
PRINT CAR MODEL
ON TABLE SUBFOOT
"&TOTAL"
END
-EXIT

Have you ECHOed (-SET &ECHO=ALL) back what's running? That will show you if the variable is being populated.
 
Report This Post
Gold member
posted Hide Post
Sorry I kind of summarized the table on that IF because I was thinking my question was emphasized on that &records. so I did not just explain properly on that if statement.
This is actually how my table looks like with a define statement:
SUMCRS /A01 = IF COURSES NE LAST COURSES THEN 'Y' ELSE 'N';
then in the table file, I have
IF SUMCRS EQ 'Y'
the table works without any problem like I have mentioned it in the previous statements. &RECORDS is my main problem. I do have my echo ON and I see 172 records, but not in the subfoot.


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Expert
posted Hide Post
kmafu,
I agree with Rick.
Changing to WHERE made it work swell for me.




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
<RickW>
posted
kmafu, if you're able to see that the variable is being set properly with ECHO I really don't see why it wouldn't show up - it's pretty cut-n-dry. Sorry.
 
Report This Post
Virtuoso
posted Hide Post
The problem is with the combination of an 'IF' test using the keyword LAST. Believe it not the word LAST is considered a FUNCTION. It is found in the User Functions Manual. IF statements cannot use functions and therefore if you view the ECHO of the code you will see that an error is thrown because of the IF statement using the LAST function. Either use the WHERE statement or eliminate the IF statment and you will see the correct value for &TOTAL.

the key here is the usage of a function is not permitted in an IF statement but are OK in WHERE statements. This is why the code with the WHERE statement works. The value for &TOTAL shows as zero because of the sytax error of the IF statement. The fact that you still receive a result report is masking where the real problem is. I bet if you examine your report results closely you would probably find that the IF statement was not applied.


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
<RickW>
posted
quote:
Sorry I kind of summarized the table on that IF because I was thinking my question was emphasized on that &records. so I did not just explain properly on that if statement.
This is actually how my table looks like with a define statement:
SUMCRS /A01 = IF COURSES NE LAST COURSES THEN 'Y' ELSE 'N';
then in the table file, I have
IF SUMCRS EQ 'Y'
the table works without any problem like I have mentioned it in the previous statements. &RECORDS is my main problem. I do have my echo ON and I see 172 records, but not in the subfoot.


I don't think kmafu actually *used* that IF statement - he/she was just explaining it.

That being said - it should work.
 
Report This Post
Virtuoso
posted Hide Post
both of the following work:

DEFINE FILE CAR
DUPLMOD/A01=IF MODEL NE LAST MODEL THEN 'Y' ELSE 'N';
END

TABLE FILE CAR
PRINT MODEL
BY CAR
WHERE DUPLMOD EQ 'Y'
ON TABLE HOLD
END
-RUN
-SET &TOTAL=&RECORDS;
TABLE FILE HOLD
PRINT CAR MODEL
ON TABLE SUBFOOT
"&TOTAL"
END

TABLE FILE CAR
PRINT MODEL
BY CAR
IF DUPLMOD EQ 'Y'
ON TABLE HOLD
END
-RUN
-SET &TOTAL=&RECORDS;
TABLE FILE HOLD
PRINT CAR MODEL
ON TABLE SUBFOOT
"&TOTAL"
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Gold member
posted Hide Post
Here's the error messages I keep getting:
IF SUMCRS EQ 'Y'
ON TABLE HOLD AS RC2
END
-RUN
-SET &TOTAL1 = 0;
Invalid switch - "NOCONFIRM".
Invalid switch - "NOCONFIRM".
Invalid switch - "NOCONFIRM".
0 NUMBER OF RECORDS IN TABLE= 753 LINES= 753
0 NUMBER OF RECORDS IN TABLE= 753 LINES= 753
0 NUMBER OF RECORDS IN TABLE= 722 LINES= 722
-SET &TOTAL1 = 722;
DEFINE FILE RC2
...
END
TABLE FILE RC2
...
BY ROOT_KEY
ON TABLE PCHOLD AS RC2A
END
-RUN
-INCLUDE REMOTE_END.FEX
-* File remote_end.FEX
VMS DEL/SIN/NOCONF *.FTM;
VMS DEL/SIN/NOCONF *.MAS;
VMS DEL/SIN/NOCONF FOCSORT.FOC;*
-REMOTE END
ERROR AT OR NEAR LINE 2 IN PROCEDURE EDAAPI FOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: RC2
BYPASSING TO END OF COMMAND
ERROR AT OR NEAR LINE 342 IN PROCEDURE EDAAPI FOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: RC2
BYPASSING TO END OF COMMAND
-TYPE WEBFOCUS CGIVAR IBIWF_mreports=INDEX
-TYPE WEBFOCUS CGIVAR IBIWF_index=OFF

in the report, I see this:
TABLE FIEL RC2A
...
ON TABLE SUBFOOT
" "
"Total Number of Courses: 722"
" "
so it does pick it up. BUT the error is still there and is not producing the report:
END
-RUN
0 ERROR AT OR NEAR LINE 441 IN PROCEDURE RFINEXCLFOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: RC2A
BYPASSING TO END OF COMMAND

This is where I've been stuck..


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Virtuoso
posted Hide Post
Curiosity question, is the FIEL below, just a typo on your part?

quote:
in the report, I see this:
TABLE FIEL RC2A
...
ON TABLE SUBFOOT
" "
"Total Number of Courses: 722"
" "
so it does pick it up. BUT the error is still there and is not producing the report:
END
-RUN
0 ERROR AT OR NEAR LINE 441 IN PROCEDURE RFINEXCLFOCEXEC *
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: RC2A
BYPASSING TO END OF COMMAND


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
<RickW>
posted
Based on your code errors, it has absolutley nothing to do with &TOTAL. It can't find the RC2 HOLD file. I'm not sure what the

Invalid switch - "NOCONFIRM".

is - looks like an error message. I suggest using -EXITs and running your code segments to debug your program.
 
Report This Post
Expert
posted Hide Post
.... plus using -RUN after every TABLE request to ensure the messages are relevantly placed within your echoed output.



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
Gold member
posted Hide Post
Thanks for all the posts..
As for the FIEL that was the typo when I was typing in here..sorry :-D
As for the -RUN I do have it after every table file. and for -EXIT, I have tried it and no prob without &total. so far I have tried everything I could think of already..Without the &total, the fex works great. But when I put back in &total (though it has the record counts shown in my previous post) I got that invalid switch error and then every table after that are not recognized anymore. I am running out of ideas, so I've decided to come here to post to see if I can get help on that..

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


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Expert
posted Hide Post
I notice that you have a REMOTE END in your code, so obviously you are running it elsewhere. This may have some bearing on the ability to retrieve the &TOTAL1 variable but as it is quite a few years since I have had to use -REMOTE I'm afraid I can't remember (last used with PC Focus 6.4!).

Perhaps someone who still uses -REMOTE may be able to put some light onto this?

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
Platinum Member
posted Hide Post
Here's an example without using the &RECORDS variable.

TABLE FILE CAR
PRINT MODEL
BY CAR
WHERE MODEL NE LAST MODEL
ON TABLE HOLD
END
-RUN
DEFINE FILE HOLD
CNT/I5SC = 1;
END
TABLE FILE HOLD
PRINT CAR MODEL
ON TABLE SUBFOOT
" "
"Total number of records = " "
END

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Gold member
posted Hide Post
Thanks. I had similar codes already put in this early morning and it worked without a prob. But I'd still like to find out why that invalid switch is for us here since we have alot of fexes using &records for different reasons.

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


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
Virtuoso
posted Hide Post
The section of code within the -REMOTEs is treated as a script (pure Focus code, no dialog manager) on the remote server. Any &vars are resolved locally before it is shipped, and the system vars (&LINES etc.) created during remote execution are not accessible locally.

But when you PCHOLD the result, you can then locally Table and Hold from that file to set &RECORDS and &LINES locally.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
shot in the dark... change the name of the variable from &TOTAL to something else...something that has no possible sane meaning in some operating system guts.
Like &HOWMANY
and when you put it in your header, separate the header quotes with a space
" &HOWMANY "
Java has some reserved words that &vars and statement labels sometimes trip over.




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
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders