Focal Point
[CLOSED]Plain Text output with some modifications

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

June 06, 2016, 09:58 AM
cs_source
[CLOSED]Plain Text output with some modifications
I need to create a file in plain text and when i browsed focal point i found out you can use
ON TABLE PCHOLD FORMAT DOC as output which is partially there. I need some assistance figuring out the last bit.

Below is the expected output and i have some questions:

A) How i can remove leading zeros? Based off another thread i see i can place <0> before headings but there is still one space.

B) How i can remove leading zeros from fields on the report?

C) How can i add 14 spaces between two columns?

-* the first string 1234567...25 based on a field
-* there are 14 spaces shown as _
-* 1234 is right aligned based off another field
1234567...25______________1234


Thank you!

This message has been edited. Last edited by: <Emily McAllister>,


WebFocus 8.02, SQL Server 2008r2
June 06, 2016, 03:13 PM
Danny-SRL
Hi cs,

You do not say what you want to do with your plain text file:
1. Use it as input to something?
2. Create a WORD document?
3. Simply print it?
4. Anything else?
If you do use FORMAT DOC, you should not see any leading zeros, unless you have an L option on a numeric field; and a field containing 14 spaces should display as 14 spaces.

Could you post your code, preferably a repro using the CAR file?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

June 06, 2016, 04:47 PM
Waz
From what you have said, I think HOLD FORMAT ALPHA may be a better way.

You can use FPRINT to format the fields.

But as Danny says, what do you want to use it for, it has a large bearing on the method to be used.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

June 07, 2016, 12:36 PM
George Patton
I'm in total agreement with Danny and Waz - not just concerning this post but posts in general. It helps an awful lot if the general objective is spelled out at the beginning before getting to the code. Often enough there is a completely different and better way to accomplish something rather than tinkering with code that is already lame to start with.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
June 07, 2016, 04:22 PM
Doug
I'm in total agreement with Danny, Waz, And George. There are many ways to Skin-A-Cat. But, it's always nice to know what kind of cat it is, Kitty Cat, Bengal or Sabre Tooth Tiger... Confused
June 14, 2016, 10:02 AM
cs_source
Thank you Danny and Waz;

The purpose of the file is to upload to an internal application. The file type must be .txt and the type of files needs to follow a standard which is what i'm attempting to configure. My goal for the file is to use Report Caster to place the file on a network share so a co-worker can access the file make any last minute adjustments and then upload to our application.

Waz, when the output is set as ALPHA i notice the header is removed but the leading spaces concern is resolved.

####################################
Below is my code and some notes i have:

DEFINE FILE [SYNONYM]
-*I thought to create this so one of our co-workers knows where to right align the number (14 spaces after Field1). I wasn't sure how to complete this in webfocus?
SPACE/A50=[SYNONYM].[SYNONYM].[FIELD1][||' |';
END

TABLE FILE [SYNONYM]
SUM
COMPUTE [NEW_FIELD1]/I8 = [SYNONYM].[SYNONYM].[FIELD2] * 100; AS 'ALIGN LAST DIGIT WITH |.'
BY LOWEST [SYNONYM].[SYNONYM].SPACE AS 'REMOVE THIS LINE. LEADING SPACES. LINE BELOW'
HEADING
-*I need two headers in the file
"HEADER1"
"HEADER2"
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT ALPHA
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
TYPE=DATA,
COLUMN=N2,
JUSTIFY=LEFT,
$
TYPE=DATA,
COLUMN=N3,
JUSTIFY=LEFT,
$
TYPE=TITLE,
COLUMN=N2,
JUSTIFY=LEFT,
$
TYPE=TITLE,
COLUMN=N3,
JUSTIFY=LEFT,
$
TYPE=HEADING,
LINE=1,
JUSTIFY=LEFT,
$
TYPE=HEADING,
LINE=2,
JUSTIFY=LEFT,
$
TYPE=REPORT,
COLUMN=N2,
SQUEEZE=ON,
$
TYPE=REPORT,
COLUMN=N1,
SQUEEZE=ON,
$
ENDSTYLE
END

################################################
The output file will look like this:

HEADER1
HEADER2
REMOVE THIS LINE. LEADING SPACES. LINE BELOW ALIGN LAST DIGIT WITH |.
-------------------------------------------- ------------------------
XXXXXXXXXXXXXXXXXXXXXXXXX | 999

################################################
The final state of the file should look like this:

HEADER1
HEADER2
XXXXXXXXXXXXXXXXXXXXXXXXX 999


WebFocus 8.02, SQL Server 2008r2