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
[SOLVED]SORTBY
 Login/Join
 
Member
posted
I have an HTML page that has several drop downs (4 of them to be exact) to sort the report they are executing.

How can have a dynamic sortby... Something like this? APP Studio doesn't like the code...
TABLE FILE PRODDAT2/CRIME
PRINT
CRIME.SELECTN.INSD_CLAIMNO AS 'Claim #'
CRIME.L_DESC.KIND_LOSS AS 'Kind of Loss'
CRIME.CAU_DESC.CAUSITIV_DES AS 'Cause'
CRIME.SELECTN.LOCATION_CD AS 'Location Code'
CRIME.LEVEL5.LOC_NAME AS 'Location Name,'
CRIME.SELECTN.INCDNT_STATE AS 'State,'
CRIME.POLYR.POLICY_YR AS 'Policy Year,'
CRIME.DETAILS.DATE_RPTD AS 'Date Reported'
CRIME.SELECTN.DATE_OF_LOSS AS 'Date of Loss'
CRIME.SELECTN.TOT_LOSS_AMT/D12.2M AS 'Total,Loss Amount'
CRIME.LOSSES.RECOVERY AS 'Recovery'
COMPUTE NTL/D12.2 = CRIME.SELECTN.TOT_LOSS_AMT - CRIME.LOSSES.RECOVERY; AS 'Net ,Loss Amount'
IF &SORTBY1 EQ ‘ ‘ THEN GOTO NOSORTBY1;
BY &SORTBY1 NOPRINT
NOSORTBY1
IF &SORTBY2 EQ ‘ ‘ THEN GOTO NOSORTBY2;
BY &SORTBY2 NOPRINT
NOSORTBY2
IF &SORTBY3 EQ ‘ ‘ THEN GOTO NOSORTBY3;
BY &SORTBY3 NOPRINT
NOSORTBY3
IF &SORTBY4 EQ ‘ ‘ THEN GOTO NOSORTBY4;
BY &SORTBY4 NOPRINT
NOSORTBY4
I get an error message when I try and save the report.

This message has been edited. Last edited by: <Emily McAllister>,
 
Posts: 15 | Registered: April 12, 2016Report This Post
Master
posted Hide Post
For starters, you need a dash in front of your IF and GOTO label name, like this:

-IF &SORTBY1 EQ ‘ ‘ THEN GOTO NOSORTBY1;
BY &SORTBY1 NOPRINT
-NOSORTBY1;

And put a semicolon after the GOTO label name, as well.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
quote:
put a semicolon after the GOTO label name, as well.

Sorry Squatch, but that is incorrect syntax!

However, as you correctly show THEN is required in the THEN GOTO. If folks have got used to not adding THEN (in WF 7 and earlier) then they may hit issues when reaching WF 8.

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
Master
posted Hide Post
quote:

Sorry Squatch, but that is incorrect syntax!

Then there are many other examples that turn up in a search on this forum that must be wrong as well.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
I've never used a THEN in a GOTO...


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
CHANGE IT TO...AND I STILL GET AN ERROR MESSAGE IN APP STUDIO...."ERROR PARSING REPORT REQUEST"



-IF &SORTBY1 EQ ‘ ‘ THEN GOTO NOSORTBY1;
BY &SORTBY1 NOPRINT
-NOSORTBY1;

-IF &SORTBY2 EQ ‘ ‘ THEN GOTO NOSORTBY2;
BY &SORTBY2 NOPRINT
-NOSORTBY2;

-IF &SORTBY3 EQ ‘ ‘ THEN GOTO NOSORTBY3;
BY &SORTBY3 NOPRINT
-NOSORTBY3;

-IF &SORTBY4 EQ ‘ ‘ THEN GOTO NOSORTBY4;
BY &SORTBY4 NOPRINT
-NOSORTBY4;
 
Posts: 15 | Registered: April 12, 2016Report This Post
Master
posted Hide Post
A semicolon is not required for a GOTO label, but it doesn't cause a problem:

-SET &SKIP_MODEL='SKIP';

TABLE FILE IBISAMP/CAR
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
-IF &SKIP_MODEL EQ 'SKIP' THEN GOTO NO_MODEL;
BY  CAR.CARREC.MODEL
-NO_MODEL;
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET CACHELINES 100
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END

This also works for me:

-SET &SKIP_MODEL='SKIP'

TABLE FILE IBISAMP/CAR
BY  CAR.ORIGIN.COUNTRY
BY  CAR.COMP.CAR
-IF &SKIP_MODEL EQ 'SKIP' GOTO NO_MODEL
BY  CAR.CARREC.MODEL
-NO_MODEL
ON TABLE SET EMPTYREPORT ON
ON TABLE SET HTMLENCODE ON
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET CACHELINES 100
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET HTMLCSS ON
END

Maybe WebFOCUS was more sensitive in the past... I wouldn't know about that. But it seems tolerant of the present/missing semicolons now.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
quote:
A semicolon is not required for a GOTO label, but it doesn't cause a problem:

Oh yes, the "it has never been a problem" only for code tightening to bite you in the posterior in future releases!

I suppose one thing to be said for the GUI is that some coding standards are applied.

Now when Dialogue Manager is fully GUI-ised ...... Music

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
Expert
posted Hide Post
"ERROR PARSING REPORT REQUEST"

When do you get this error? When attempting to open the edited code in a GUI tool? When running the code?

This most likely will not open in the GUI - it doesn't like Dialogue Manager (scripting) commands mixed in with WebFOCUS report code.
TABLE FILE PRODDAT2/CRIME
PRINT
CRIME.SELECTN.INSD_CLAIMNO AS 'Claim #'
CRIME.L_DESC.KIND_LOSS AS 'Kind of Loss'
CRIME.CAU_DESC.CAUSITIV_DES AS 'Cause'
CRIME.SELECTN.LOCATION_CD AS 'Location Code'
CRIME.LEVEL5.LOC_NAME AS 'Location Name,'
CRIME.SELECTN.INCDNT_STATE AS 'State,'
CRIME.POLYR.POLICY_YR AS 'Policy Year,'
CRIME.DETAILS.DATE_RPTD AS 'Date Reported'
CRIME.SELECTN.DATE_OF_LOSS AS 'Date of Loss'
CRIME.SELECTN.TOT_LOSS_AMT/D12.2M AS 'Total,Loss Amount'
CRIME.LOSSES.RECOVERY AS 'Recovery'
COMPUTE NTL/D12.2 = CRIME.SELECTN.TOT_LOSS_AMT - CRIME.LOSSES.RECOVERY; AS 'Net ,Loss Amount'
IF &SORTBY1 EQ '' GOTO NOSORTBY1;
BY &SORTBY1 NOPRINT
-NOSORTBY1
IF &SORTBY2 EQ '' GOTO NOSORTBY2;
BY &SORTBY2 NOPRINT
-NOSORTBY2
IF &SORTBY3 EQ '' GOTO NOSORTBY3;
BY &SORTBY3 NOPRINT
-NOSORTBY3
IF &SORTBY4 EQ '' GOTO NOSORTBY4;
BY &SORTBY4 NOPRINT
-NOSORTBY4
END


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
Expert
posted Hide Post
quote:
I suppose one thing to be said for the GUI is that some coding standards are applied.

But whose?


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
Expert
posted Hide Post
quote:
never used a THEN in a GOTO

I'm sure that in the past I didn't either. Until the dreaded upgrade taught me a lesson or two.

I encountered a double semi-colon (not sure if it was a WHERE clause or DM code) that caused no issue in WF 7.1.6 but objected big time in WF 7.7.03. The error message wasn't too accurate either, if I remember correctly. Took me a while to spot the second semicolon Frowner

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
Expert
posted Hide Post
quote:
But whose?

SmilerSmilerSmiler One would hope that is was documented standards Francis, but you knew that Wink

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
Expert
posted Hide Post
From the Developing Reporting Applications > Managing Flow of Control in an Application > Navigating a Procedure documentation:

quote:

Syntax: How to Perform Conditional Branching
-IF expression [THEN] {GOTO label1|CONTINUE} [ELSE IF...;] [ELSE {GOTO label2|CONTINUE}];
where:

expression
Is a valid expression. Literals do not need to be enclosed in single quotation marks unless they contain embedded blanks or commas.

THEN
Is an optional command that increases readability of the command.


label1
Is a user-defined name of up to 64 characters to which to pass control if the -IF test is true. Do not use embedded blanks or the name of any other Dialogue Manager command except -QUIT or -EXIT. Do not use arithmetic or logical operations, words that can be confused with functions or reserved words, such as CONTINUE.

The label text may precede or follow the -IF criteria in the procedure.

CONTINUE
Continues to the command that follows the semicolon of the -IF command.

Note: CONTINUE cannot be used as a label in a -IF statement.

ELSE IF
Specifies a compound -IF test. The command -IF must end with a semicolon to signal that all logic has been specified. For more information, see Performing a Compound -IF Test.

ELSE GOTO
Passes control to label2 when the -IF test fails.

If a command spans more than one line, continuation lines must begin with a hyphen and one or more spaces.


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
Expert
posted Hide Post
If your DM branching is causing you grief, then how about building your sort phrase into a single DM variable and then adding that into your code? Use .QUOTEDSTRING to maintain embedded single quotes within your string.

Not tested but should work.

-SET &BYCLAUSE = '';
-SET &BYCLAUSE = IF &SORTBY1 EQ ' ' THEN '' ELSE &BYCLAUSE.QUOTEDSTRING || (' BY ' | &SORTBY1.QUOTEDSTRING) || (' NOPPRINT') ;
-SET &BYCLAUSE = IF &SORTBY2 EQ ' ' THEN &BYCLAUSE.QUOTEDSTRING ELSE &BYCLAUSE.QUOTEDSTRING || (' BY ' | &SORTBY2.QUOTEDSTRING) || (' NOPPRINT');
-SET &BYCLAUSE = IF &SORTBY3 EQ ' ' THEN &BYCLAUSE.QUOTEDSTRING ELSE &BYCLAUSE.QUOTEDSTRING || (' BY ' | &SORTBY3.QUOTEDSTRING) || (' NOPPRINT');
-SET &BYCLAUSE = IF &SORTBY4 EQ ' ' THEN &BYCLAUSE.QUOTEDSTRING ELSE &BYCLAUSE.QUOTEDSTRING || (' BY ' | &SORTBY4.QUOTEDSTRING) || (' NOPPRINT');


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
Expert
posted Hide Post
quote:
THENIs an optional command that increases readability of the command.

Interesting, however, I have seen it cause issues.

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
I am trying to do this in APP STUDI0
 
Posts: 15 | Registered: April 12, 2016Report This Post
Expert
posted Hide Post
quote:
I am trying to do this in APP STUDI0

Please tell us what you mean by this statement. It appears we've been talking about coding in this thread - opening the procedure in the App Studio built-in text editor or an external text editor, then modifying the code by typing it, then saving and running.

I'm pretty sure the error "ERROR PARSING REPORT REQUEST" occurs when you open a procedure in the App Studio procedure GUI (I'm not sure what it's called) and it encounters code it cannot parse.

The most likely reason it cannot parse the code is that it does not like Dialogue Manager code mixed in with WebFOCUS reporting code.

Please clarify exactly how you are working with the procedure - was it built in the GUI, then you edited it in a text editor, then you're attempting to open it in the GUI?


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
Master
posted Hide Post
I tried opening the test code I posted earlier, and App Studio gave me a warning about Dialogue Manager commands being present, and then an option to open as text or continue to the GUI.

When I continue to the GUI, App Studio strips out the Dialogue Manager code. So I suspect Matt still has invalid code somewhere.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Member
posted Hide Post
Yes, I am sorry if I wasn't clear. I created a report using the GUI portion of APP Studio and then went into the "source" to add my by fields. I am new to APP STUDIO so if there is a way to do it let me know.
 
Posts: 15 | Registered: April 12, 2016Report This Post
Master
posted Hide Post
There is a slide out panel on the left side of App Studio called "Procedure View". You can right-click on "Dialog Mngr" and insert Dialog Manager commands.

I've never used it, because it's easier just to type the DM commands in by hand. It's not clear to me how you can mix in DM commands with report generating code. I don't think you can.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Expert
posted Hide Post
Matt B,
This may or may not work, but, will suggest anyway.

At the very top add:
-MRNOEDIT BEGIN
At the very bottom, add:
-MRNOEDIT END

If this doesn't work, need to add to a folder on your APP PATH and call it from CONTENT:
-MRNOEDIT -INCLUDE folder_name/MattB_New_fex.fex


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
It's possible you might be able to do this using only the GUI. Instead of using blank as the non-selected drop-down value, use "_FOC_NULL". Then, in your GUI created procedure, your BY statements can exist without the -IF and GOTO statements. If the selected value is "_FOC_NULL", the BY is ignored.


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
Expert
posted Hide Post
quote:
It's possible you might be able to do this using only the GUI

Do my eyes deceive me? Roll Eyes

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
Master
posted Hide Post
quote:
Originally posted by Francis Mariani:
It's possible you might be able to do this using only the GUI.

As Tony has pointed out, irony can be pretty ironic sometimes. Smiler


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
 
Posts: 594 | Location: Michigan | Registered: September 04, 2015Report This Post
Member
posted Hide Post
Thank you everybody for your input...I solved the problem this morning...

1. Dialogue Manager in APP Studio
Enter the follow information
-SET &SORTBY1LINE = IF &SORTBY1 EQ ' ' THEN ' ' ELSE 'BY ' | &SORTBY1 ;
-SET &SORTBY2LINE = IF &SORTBY2 EQ ' ' THEN ' ' ELSE 'BY ' | &SORTBY2 ;
-SET &SORTBY3LINE = IF &SORTBY3 EQ ' ' THEN ' ' ELSE 'BY ' | &SORTBY3 ;
-SET &SORTBY4LINE = IF &SORTBY4 EQ ' ' THEN ' ' ELSE 'BY ' | &SORTBY4 ;

(&SORTBY1, &SORTBY2, &SORTBY3, &SORTBY4 --> These are the values that are being passed by the HTML page)

2. In Optional Parameters I set the following
-DEFAULT &SORTBY1LINE = ' ';
-DEFAULT &SORTBY1 = ' ';
-DEFAULT &SORTBY2LINE = ' ';
-DEFAULT &SORTBY2 = ' ';
-DEFAULT &SORTBY3LINE = ' ';
-DEFAULT &SORTBY3 = ' ';
-DEFAULT &SORTBY4LINE = ' ';
-DEFAULT &SORTBY4 = ' ';

3. In the report (code itself) - Added the 4 &SORTBY1lINE &SORTBY2lINE &SORTBY3lINE &SORTBY4LINE
PRINT
CRIME.SELECTN.INSD_CLAIMNO AS 'Claim #'
CRIME.L_DESC.KIND_LOSS AS 'Kind of Loss'
CRIME.CAU_DESC.CAUSITIV_DES AS 'Cause'
CRIME.SELECTN.LOCATION_CD AS 'Location Code'
CRIME.LEVEL5.LOC_NAME AS 'Location Name,'
CRIME.SELECTN.INCDNT_STATE AS 'State,'
CRIME.POLYR.POLICY_YR AS 'Policy Year,'
CRIME.DETAILS.DATE_RPTD AS 'Date Reported'
CRIME.SELECTN.DATE_OF_LOSS AS 'Date of Loss'
CRIME.SELECTN.TOT_LOSS_AMT/D12.2M AS 'Total,Loss Amount'
CRIME.LOSSES.RECOVERY AS 'Recovery'
COMPUTE NTL/D12.2 = CRIME.SELECTN.TOT_LOSS_AMT - CRIME.LOSSES.RECOVERY; AS 'Net ,Loss Amount'

&SORTBY1LINE
&SORTBY2LINE
&SORTBY3LINE
&SORTBY4LINE
 
Posts: 15 | Registered: April 12, 2016Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders