Focal Point
Issue With ACROSS

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6291065813

February 16, 2009, 11:51 PM
saggy
Issue With ACROSS
I have a small issue while using ACROSS
Let me Illustrate that with an eg:
Please see the following code

TABLE FILE CAR
SUM
CNT.SEATS AS 'StatusCnt'
BY MODEL AS 'Business'
BY CAR AS 'Company'
ACROSS COUNTRY AS ''
ON TABLE SET PAGE-NUM OFF
ON TABLE SET PAGE NOLEAD
END

And this code produces an o/p something like this

ENGLAND FRANCE ITALY JAPAN W GERMANY
Business Company
100 LS 2 DOOR AUTO AUDI 0 0 0 0 1
2000 4 DOOR BERLINA ALFA ROMEO 0 0 1 0 0
2000 GT VELOCE ALFA ROMEO 0 0 1 0 0

But I want that extra space which is in between the line1 and line2 of the o/p to be removed, i mean the o/p shld look something like this :


Business Company ENGLAND FRANCE ITALY JAPAN W GERMANY
100 LS 2 DOOR AUTO AUDI 0 0 0 0 1
2000 4 DOOR BERLINA ALFA ROMEO 0 0 1 0 0
2000 GT VELOCE ALFA ROMEO 0 0 1 0 0

All the column names should be in the same line and i want to know how this can be done, i know this problem is because of using ACROSS.

Please suggest me a way to resolve this problem. Thanks


7.6.4
Unix & Windows
Excel,HTML,PDF,PPT,AHTML


February 17, 2009, 06:58 AM
Tewy
Try this:

SET ASNAMES=ON
-RUN
TABLE FILE CAR
SUM
CNT.SEATS AS 'StatusCnt'
BY MODEL AS 'Business'
BY CAR AS 'Company'
ACROSS COUNTRY AS ''
ON TABLE SET PAGE-NUM OFF
ON TABLE SET PAGE NOLEAD
ON TABLE HOLD AS MYFILE FORMAT ALPHA
END
-RUN
TABLE FILE MYFILE
PRINT *
END  



WF 7.6.11
Output: HTML, PDF, Excel
February 17, 2009, 09:02 AM
saggy
Thanks a ton tewy that worked...
And could you please lemme knw why you used
1) RUN before both the table requests, does this have anything to do with the performance??
2) FORMAT ALPHA, how does that influence the format of the o/p??


7.6.4
Unix & Windows
Excel,HTML,PDF,PPT,AHTML


February 17, 2009, 09:19 AM
Tony A
saggy,

Don't look a gift horse in the mouth!

You can look up the use of FORMAT ALPHA - and all the other formats - in manuals.

You can also find out why -RUN is used, and that is, to execute the current contents of the parsed stack.

T
February 17, 2009, 09:27 AM
GinnyJakes
1) In this particular instance, you don't need the -RUN. It is normally used to execute the focstack prior to running another Dialogue Manager command that would need the results of the previous FOCUS command.

2) In this particular instance, the format is irrelevant and the output will be the same. However, those of us who create a lot of hold files with WebFOCUS find that FORMAT ALPHA tends to be more flexible than the default format BINARY.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
February 17, 2009, 09:38 AM
Tewy
Just to answer;

1) Habit! I find when reading the code -RUN statements break it up to make it easier to read (personal preferance). Plus in older versions of WebFOCUS when I used to (on occasion) watch the output of SET ECHO=ALL in the command window whilst waiting for a result, -RUN made it put the number of lines of output etc under each table request, without the -RUN you just got all your code, followed by all the results. Made error trapping easier.

2) Using SET ASNAMES=ON and FORMAT ALPHA changes the fieldname of your STATUSCNT to STATUSCNT and the relevant country.


WF 7.6.11
Output: HTML, PDF, Excel
February 19, 2009, 12:14 AM
saggy
Hi tewy please examine the following code

I had problems retaining the column totals in the alpha hold file.
To over come this i calculated the totals just before printing the contents but the totals came up in two lines
sm thing like this

Total
138,134 4 1 4 2 7

so could you please help me out on this..and i want the final o/p to be out in excel , so do we have any approaches on getting the totals in excel??Please suggest. TIA

SET ASNAMES=ON
-RUN
TABLE FILE CAR
SUM
CNT.SEATS AS ''
BY DEALER_COST AS 'Business'
BY CAR AS 'Company'
ACROSS COUNTRY AS ''
ON TABLE SET PAGE-NUM OFF
ON TABLE SET PAGE NOLEAD
ON TABLE HOLD AS MYFILE FORMAT ALPHA
END
-RUN
TABLE FILE MYFILE
PRINT *
ON TABLE COLUMN-TOTAL AS 'Total'
END


7.6.4
Unix & Windows
Excel,HTML,PDF,PPT,AHTML


February 19, 2009, 04:27 AM
Tewy
Your problem is because the first column in your print is a numeric column for which WebFOCUS will provide a total, if the column were alpha you'd be able to have the word TOTAL and the total values on the same line.

Rearrange your columns so there is an alpha field as your first sort field.


WF 7.6.11
Output: HTML, PDF, Excel
February 19, 2009, 10:53 AM
j.gross
Here's a way, but there's a tradeoff -- You get TOTAL and the total values on a single line, at the cost of indenting the entire report a bit.

DEFINE FILE CAR
NADA/A1=;
END
TABLE FILE CAR
SUM
CNT.SEATS AS ''
BY NADA AS ''
BY DEALER_COST
BY CAR
ACROSS COUNTRY AS ''
ON TABLE SUMMARIZE
END

This message has been edited. Last edited by: j.gross,
February 19, 2009, 10:57 AM
saggy
DEFINE FILE CAR
V_SC/A100 = MODEL || COUNTRY;
V_AC/A100 = IF V_SC EQ 'M1' THEN 'King' ELSE IF V_SC EQ 'M2' THEN 'Queen' ELSE IF V_SC EQ 'M3' THEN 'Jose' ELSE IF V_SC EQ 'M4' THEN 'Alpha' ELSE 'Beta';
Model/A100 = MODEL;
Country/A100 = COUNTRY;
END

TABLE FILE CAR
SUM
CNT.V_SC AS ''
BY Model
BY Country
ACROSS V_AC AS ''
ON TABLE HOLD AS MYFILE FORMAT ALPHA
END

TABLE FILE MYFILE
PRINT
*
ON TABLE COLUMN-TOTAL AS 'Total'
END

Try this this stil din help me out of the problem my first by is a alpha nw.


7.6.4
Unix & Windows
Excel,HTML,PDF,PPT,AHTML