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
SORTING PROBLEM
 Login/Join
 
<ROSESINN>
posted
Hello Everyone,
i need to create a report with multiple sorts and the sort values are entered by the user. so i defined the by fields as &sorts .the problem is if the user enters a perticular sort option then it should sort the data and also add an additional column beside it .for example if the user is sorting by empid then it should sort the data and also display empname field data beside the empid and if the user is not selecting empid as sort option then it shouldnt display empname in the report data.
hope you understood my problem.thanks guys for ur help.
 
Report This Post
Expert
posted Hide Post
table file car
sum sales by highest weight noprint
by country by model by weight
end

...
put a NOPRINT after the sort variable
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
I think I understand what you want. There are many ways to tackle this. See if this works for you.

-SET &sorts2 = IF &sorts EQ 'empid' THEN 'empid BY empname';

Then in your code write

BY &sorts2
 
Posts: 90 | Location: Tinker AFB | Registered: June 03, 2003Report This Post
Guru
posted Hide Post
Would this work for you?

-SET &SORT = 'CAR';

TABLE FILE CAR
SUM RETAIL_COST DEALER_COST

-GOTO :&SORT

-:COUNTRY
BY COUNTRY
-GOTO :END_SORT

-:CAR
BY CAR
-GOTO :END_SORT

-:MODEL
BY MODEL
-GOTO :END_SORT

-:END_SORT
END
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
<ROSESINN>
posted
Hi ,
thanks for ur replies. i tried the solution given by boogerweed and its working fine but the problem is if i am sorting by empid i want the empname column to be next to empid.
thanks
rosesinn
 
Report This Post
<JG>
posted
That's exactly what boogerweed's answer does.
If you want the name before the id, just reverse the fields.
Also If you have multiple possibilities as I suspect you might, then use a decode instead of IF THEN ELSE.
 
Report This Post
Gold member
posted Hide Post
JG,

what is the main difference between "if/else" and decode such that your saying to use the decode function instead of the "if/else"?

I've mainly used the if/else in these situations probably because its more relevant to other programming languages I've used but when I looked up the decode, I didn't see anything that would imply its any different then the if/else statement.

thanks,

Leo
 
Posts: 96 | Location: Winnipeg, Manitoba, Canada | Registered: January 22, 2004Report This Post
<ROSESINN>
posted
Hi guys,
here is my sample code

-SET &SORT2 = IF &SORT1 EQ '' THEN ' ' ELSE IF &SORT1 EQ 'empid' THEN 'then ename BY empid ' ELSE IF &SORT1 EQ 'deptno' THEN 'dname BY deptno' ELSE 'BY '| &SORT1 |'';
TABLE FILE SQLOUT
PRINT
sal
comm
&SORT2
END
now if i am giving empid as my sort option i want my report to be displayed as

EMPID ENAME SAL COMM
BUT IT IS DISPLAYING AS
EMPID SAL COMM ENAME
and if i am NOT GIVING ANY VALUE TO my sort option i want my report to be displayed as

SAL COMM

THANKS GUYS
 
Report This Post
Guru
posted Hide Post
In Boogarweed's example he had
BY &sorts2

Be sure to put the BY either in front of
the &sorts2 or add it into the value of &sorts2.

ie. 'BY ename BY empid'
 
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003Report This Post
<MoonLightWare>
posted
ROSESINN

I am assuming you are using a fairly current version of WebFOCUS. In the Report Painter create you variable (&sorts) and make it a by field. Then using Resource Layout create the by field as a static dropdown in the Display enter EMPID then in the value enter EMPID BY EMPNAME. I think this should work for you. Please Post you result.
 
Report This Post
<JG>
posted
Leo Historically the reason to use DECODE instead of IF THEN ELSE was due to a pre 5.2 limitation of 16 IF THEN ELSE pairs DECODE allowed 39 pairs + an ELSE. Also DECODE can take it's input from an external file.

While the 16 pair limit nolonger applies (it's dependant on available memory post 5.2) DECODE is easier to read , and requires less code. However it only does simple in value,out value substitutions not compound conditions
 
Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders