Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] title of one field based on value of another field
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] title of one field based on value of another field
 Login/Join
 
Member
posted
Hi

want to achieve something like below page.
https://www.informationbuilder...developers/PageBreak

but not through heading. is there any other way?
the requirement is
if SEATS field EQ 4 then
BY CAR AS 'Four Wheeler Car'

if SEATS field EQ 2 then
BY CAR AS 'Two Wheeler Car'

Note: consider that SEATS value will be single at a time and not known earlier. it can be anything.


Regards
Ashwini Rane

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
 
Posts: 19 | Registered: December 15, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Sounds like a job for DEFINE and ACROSS.
SET ACROSSPRT = COMPRESS

DEFINE FILE CAR
   TITLE/A100 = DECODE SEATS(4 'Four Wheeler', 2 'Two Wheeler' ELSE 'Other');
END
TABLE FILE CAR
PRINT CAR MODEL
ACROSS TITLE
END


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1603 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Member
posted Hide Post
Thanks Wep5622

No. It should not be separated by across.
Its a normal BY or PRINT and title of the field should be based on the value receiving for other field.

Regards
Ashwini Rane


WebFOCUS 8
Windows, All Outputs
 
Posts: 19 | Registered: December 15, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
I don't see how you expect to have different column titles over the same columns without using ACROSS.

The example you linked doesn't do anything like what you describe. I suggest you provide an example of the output you are looking for.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1603 | Location: Enschede, Netherlands | Registered: August 12, 2010Reply With QuoteReport This Post
Member
posted Hide Post
Hi,
If the value that decided what will be the column title is a variable then
-SET &COL_NAME = IF &variable EQ '2' THEN 'Two Wheeler' ELSE
- I F&variable EQ '4' THEN 'Four Wheeler' ELSE 'Others';

TABLE FILE CAR
PRINT CAR MODEL
BY SEAT AS '&COL_NAME.EVAL';

END

If it is a field then read the field value in a Variable and then use the above code.


WF 7.1-8.2.04
Windows/Unix
All Formats
In Focus since 2006
 
Posts: 26 | Registered: September 17, 2018Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Expanding that a bit, you could make it a loop. Like this:
-SET &SEATS = 0;
-:LABEL
-SET &SEATS = &SEATS + 1;
-IF &SEATS EQ 9 THEN GOTO :ENDOFFEX;

-SET &COLTXT = DECODE &SEATS (1 'Just one passenger' 2 'Two-seater' 3 'Carries three' 4 'Four passengers' ELSE 'Famliy');

TABLE FILE CAR
PRINT CAR AS '&COLTXT'
MODEL BODYTYPE SEATS
WHERE SEATS EQ &SEATS;
END
-GOTO :LABEL
-:ENDOFFEX

Just my 2 cents ...


GamP

- Using AS 8.2.01 on Windows 7 - IE11.
in Focus since 1988
 
Posts: 1960 | Location: Netherlands | Registered: September 25, 2007Reply With QuoteReport This Post
Member
posted Hide Post
Thanks GamP and Addy.

Thats what the problem is. Its not a variable but a field from mas and if taken in DEFINE then wont be able to use field for title as title can be customized at runtime by variable and not by field.

Regards
Ashwini Rane


WebFOCUS 8
Windows, All Outputs
 
Posts: 19 | Registered: December 15, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
I suggest you provide an example of the output you are looking for.

Yes, Please. Then we can assist you with this task.


   In FOCUS Since 1983 ~ from PC FOCUS to WebFOCUS.
   Currrently using 8204 Gen 48 in Test and Production.
   KGPCo at CenturyLink. October 2017 to Present...
 
Posts: 2805 | Location: Nashville TN Area [Test&Prod:8204Mg48] | Registered: February 23, 2005Reply With QuoteReport This Post
Member
posted Hide Post
Hi Doug

The example is same as the example given in page break link provided. Just dont want handling in header.

Regards
Ashwini Rane


WebFOCUS 8
Windows, All Outputs
 
Posts: 19 | Registered: December 15, 2015Reply With QuoteReport This Post
Member
posted Hide Post
Ashwini,
You can read the values of the filed in a variable and then set you variable that is used in title accordingly.

  
TABLE FILE CAR
PRINT
COUNTRY
WHERE RECORDLIMIT EQ 1
ON TABLE SAVE AS READ_VALUE
END
-*Considering there is only 1 value for country

-RUN
-READ READ_VALUE &COL_VALUE.A10.
-*Considering the filed format is A10
-RUN
-SET &COLTXT = DECODE &COL_VALUE (1 'Just one passenger' 2 'Two-seater' 3 'Carries three' 4 'Four passengers' ELSE 'Famliy');


TABLE FILE CAR
PRINT
CAR 
COUNTRY
BY SEAT AS '&COLTXT.EVAL'
END


WF 7.1-8.2.04
Windows/Unix
All Formats
In Focus since 2006
 
Posts: 26 | Registered: September 17, 2018Reply With QuoteReport This Post
Member
posted Hide Post
quote:
WHERE RECORDLIMIT EQ 1


tried WHERE SEATS EQ 4 instead in filter
and still it went to else block and print Family.


WebFOCUS 8
Windows, All Outputs
 
Posts: 19 | Registered: December 15, 2015Reply With QuoteReport This Post
Member
posted Hide Post
Ashwini,
Did you understand the code or just copy pasted the code.
the decode statement is working on the value from SEAT column.
I have copid that from what GamP wrote.

Did you change your Decode statement to consider country value instead of SEAT?

When you apply SEAT where conditoin you get 4 different values, as per your original post you have only 1 value at any point.

I gave you a code sample for you to understand what GamP and I are trying to explain.


WF 7.1-8.2.04
Windows/Unix
All Formats
In Focus since 2006
 
Posts: 26 | Registered: September 17, 2018Reply With QuoteReport This Post
Member
posted Hide Post
Hey,
Thanks GamP. the solution you provided worked with my example as well.


WebFOCUS 8
Windows, All Outputs
 
Posts: 19 | Registered: December 15, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] title of one field based on value of another field

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.