Focal Point
[SOLVED] Leading space in DOC letter

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

May 14, 2009, 11:15 AM
SRC
[SOLVED] Leading space in DOC letter
We use this code:
"<0 <-1 " "
"<0 This is to confirm we have received your cancellation for the " "
"<0 We are processing your refund of attend future meetings."


and get this .doc file (we can't us pdf because it won't word-wrap) Note the leading space in the fist line of each paragraph. We don't know how to stop this from occurring.

Dear Davidson:

This is to confirm we have received your cancellation for the CLINFAC210-7 N/A Clinical Faculty Workshop 2 class on 2007/10/18 .

We are processing your refund of $210.00. We hope that you will be able to attend future meetings.


Any ideas would be appreciated.

This message has been edited. Last edited by: Kerry,


Dev Studio /7.6.11/7.7.02M
MVS/USS
AIX/SOLARIS
Windows WF Client 7.6.8/7.6.11
May 14, 2009, 12:10 PM
Darin Lee
Hard to see leading spaces when they disappear in HTML. when you post code, please included it inside the code tages. Also, you can go to options and click on "disable HTML."

Here's my guess. After each of your spot markers you are leaving a space which tells WF to put a space there. If you don't want those spaces, don't put them there - just close your spot markers with a right caret > immediately followed by your text. Like
HEADING
"<5>This eliminates leading spaces."
"<5 This does not."


On a related note, you CAN word wrap in a PDF document, but WF isn't a word processor so it's not done the same way. If you put your whole paragraph, including field values into a single string, and then use the PARAG function, it subdivides the string into a specified character length and then you can use GETTOK to pull out the individual lines. Here's an example:
-* File car.fex
DEFINE FILE CAR
RCOSTA/A20=EDIT(RCOST);
SEATSA/A20=EDIT(SEATS);
LONGSTRING/A1800='If you would like to create a paragraph that contains word wrapping features for country '|COUNTRY||' and car '|CAR||
                ' you could include the cost field ('||RCOSTA||') and car information (Bodytype='||BODYTYPE||',SEATS='||SEATSA||
				') and use the PARAG subroutine along with GETTOK to properly word wrap your document.';
PARAGSTR/A400=PARAG(400,LONGSTRIN,'~',50,PARAGSTR);
LINE1/A50=GETTOK(PARAGSTR,400,1,'~',50,LINE1);
LINE2/A50=GETTOK(PARAGSTR,400,2,'~',50,LINE2);
LINE3/A50=GETTOK(PARAGSTR,400,3,'~',50,LINE3);
LINE4/A50=GETTOK(PARAGSTR,400,4,'~',50,LINE4);
LINE5/A50=GETTOK(PARAGSTR,400,5,'~',50,LINE5);
LINE6/A50=GETTOK(PARAGSTR,400,6,'~',50,LINE6);
LINE7/A50=GETTOK(PARAGSTR,400,7,'~',50,LINE7);
LINE8/A50=GETTOK(PARAGSTR,400,8,'~',50,LINE8);
END
TABLE FILE CAR
BY COUNTRY NOPRINT 
BY CAR NOPRINT PAGE-BREAK
HEADING
"<LINE1"
"<LINE2"
"<LINE3"
"<LINE4"
"<LINE5"
"<LINE6"
"<LINE7"
"<LINE8"
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=10,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
$
ENDSTYLE
END



Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
May 14, 2009, 02:18 PM
SRC
Darin, I haven't asked to customer to try the pdf solution but that is really nice to know. They will try it today.

Sorry about the problem posting code. I hope this helps. I think you can see the leading spaces.


------ CODE ---------------
"<0>"<0>"<0>"<0>" "
" "
"<0>" "
"<0>This is to confirm we have received your cancellation for the class on ."
" "
"<0>We are processing your refund of " "

------ RESULTS in .doc format ------------
Troy Cecil
3820-A Bridges St
Bonehead City, DC


Dear Troy:

This is to confirm we have received your cancellation for the Pool Inspection
HCE6030307 Keeping Swimming Safe and Healthy: Pool Inspection and Plan Review
class on 2007/02/07 .

We are processing your refund of $500.00. We hope that you will be able to attend
future meetings.




Dev Studio /7.6.11/7.7.02M
MVS/USS
AIX/SOLARIS
Windows WF Client 7.6.8/7.6.11
May 14, 2009, 03:06 PM
Francis Mariani
Please put your code (and probably that .doc output) between
[code]
[/code]
tags.


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
May 14, 2009, 03:17 PM
Francis Mariani
I don't think you can do anything about this. I ran a simple test and the result reminded me of my mainframe days. There are always two blank characters at the beginning of each report lines, heading or data. You can suppress one of the blank characters with a <-1, but that's it.

SET PAGE=NOPAGE 
TABLE FILE CAR
SUM
SALES
BY COUNTRY
BY CAR
BY MODEL
HEADING
"<-1 WEBFOCUS REPORT"
ON TABLE SET STYLESHEET *
TYPE=REPORT, ORIENTATION=LANDSCAPE, SQUEEZE=ON, FONT=ARIAL, SIZE=12, $
ENDSTYLE
ON TABLE PCHOLD FORMAT DOC
END


gives me:

 WEBFOCUS REPORT
  COUNTRY     CAR               MODEL                      SALES                                                                  
  -------     ---               -----                      -----                                                                  
  ENGLAND     JAGUAR            V12XKE AUTO                    0
                                XJ12L AUTO                 12000
              JENSEN            INTERCEPTOR III                0
              TRIUMPH           TR7                            0
  FRANCE      PEUGEOT           504 4 DOOR                     0
  ITALY       ALFA ROMEO        2000 4 DOOR BERLINA         4800
                                2000 GT VELOCE             12400
                                2000 SPIDER VELOCE         13000
              MASERATI          DORA 2 DOOR                    0
  JAPAN       DATSUN            B210 2 DOOR AUTO           43000
              TOYOTA            COROLLA 4 DOOR DIX AUTO    35030
  W GERMANY   AUDI              100 LS 2 DOOR AUTO          7800
              BMW               2002 2 DOOR                 8950
                                2002 2 DOOR AUTO            8900
                                3.0 SI 4 DOOR              14000
                                3.0 SI 4 DOOR AUTO         18940
                                530I 4 DOOR                14000
                                530I 4 DOOR AUTO           15600


You can't set the font size, font face, page orientation...


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
May 15, 2009, 04:04 AM
<JG>
Francis is correct both format DOC and WP do not allow any styling, I'd go for the PDF solution.
May 15, 2009, 09:33 AM
ira
SRC am I misreading your first line or do you have an extra double quote ?
Ira


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
May 15, 2009, 12:25 PM
EricH
JG is correct that you cannot get any true styling into HOLD FORMAT DOC - so if you are sending a letter out to a customer PDF is the way to go.

However, I am able to get output into column 1 with FORMAT DOC. The technique is somewhat limited - you cannot use PRINT with OVER - but it is useful in certain narrow situations - say if you want to generate some Dialoge Manager code from data. Here's a somewhat artificial example using CAR:

 
APP FILDEF MYCODE mycode.fex
-RUN

DEFINE FILE CAR
  DFLT_LINE1/A80 WITH COUNTRY = '-DEFAULT &' | 'FOO = ''Hello world''' ;
  DFLT_LINE2/A80 WITH COUNTRY = '-DEFAULT &' | 'GOO = ''Goodbye world'' ; ' ;
  SET_LINE1/A80  WITH COUNTRY = '-SET &' | 'MYVAR = &' || 'FOO || '' - '' | &' || 'GOO ;' ;
  TYPE_LINE1/A80 WITH COUNTRY = '-TYPE MYVAR:  &' | 'MYVAR' ;
END

TABLE FILE CAR

   PRINT
      SET_LINE1 IN 0 AS ''

   BY COUNTRY NOPRINT

   ON COUNTRY SUBHEAD
     "<0><DFLT_LINE1"
     "<0><DFLT_LINE2"

   ON COUNTRY SUBFOOT
     "<0><TYPE_LINE1"
   
   WHERE COUNTRY EQ 'ENGLAND'

ON TABLE SET EMPTYREPORT ON
ON TABLE SET PAGE-NUM NOPAGE AND LINES 999999
ON TABLE SAVE AS MYCODE FORMAT DOC
END
-RUN

-SET &ECHO = 'ALL' ;
-INCLUDE MYCODE


 


EricH
May 15, 2009, 10:57 PM
susannah
Eric
change your FILDEF to FILEDEF b4 you drive us all crazy.
well, its too late for that, but... Smiler




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
May 18, 2009, 03:04 PM
EricH
Dang it, I didn't notice that missing "E" in the FILEDEF. Good eyes there Susannah.

Interestingly enough, you don't need the FILEDEF at all in the latest releases of WebFOCUS (I happened to do my test on 7.68) It used to be that a -INCLUDE file needed a suffix of '.fex', which is why I instinctively put it in there; but somewhere along the line that rule must have been relaxed.

EricH
May 19, 2009, 05:39 AM
<JG>
EricH,

Posted this a couple of weeks ago, it explains it.
quote:

An INCLUDE must be named .fex if it resides in a location in the APP PATH
however if the file is in the working edatemp directory or it's full path is
specified it can be any extension.

The documentation on this is not very clear and contradictory.

May 20, 2009, 10:13 AM
SRC
When Francis Mariani said "reminded me of my mainframe days", that brought back memories! We are using Darin Lee's technique and that is working fine for this application.

Thanks to all............Steve


Dev Studio /7.6.11/7.7.02M
MVS/USS
AIX/SOLARIS
Windows WF Client 7.6.8/7.6.11
May 20, 2009, 12:52 PM
Doug
An interesting point: "An INCLUDE must doesn't need to be named .fex". You can do something like "-INCLUDE MYFEX.TXT" if "MYFEX.TXT" exists AND is valid FOCUS code. Just a point of interest.
-Doug
May 26, 2009, 09:51 AM
EricH
This thread seems to have been "hi-jacked" by a discussion about FILEDEF. And it's all my fault for putting that typo in my code Razzer

But as long as we're here, I did a little digging to see what was going on. AFAICT, -INCLUDE seems to come in at least four "flavors":

A) -INCLUDE BLAH
B) -INCLUDE blah.foo
C) -INCLUDE [path]blah.foo
D) -INCLUDE MYAPP/BLAH


Here's what I came up with. Taking these one at a time:

A) -INCLUDE BLAH
We know that this will execute blah.fex if blah.fex is in your APP PATH, and we also know that this will execute any arbitrary file, provided that the file is FILEDEF'd. The question that I had was, "what happens if you have both of these?" The answer is that if blah.fex is in your APP PATH, it takes precedence over any FILEDEF. So going back to my example, if you have ON TABLE SAVE AS MYCODE FORMAT DOC, and you have a mycode.fex anywhere in your APP PATH, the mycode.fex in your APP PATH executes.

B) -INCLUDE blah.foo
The only limitation here is that blah.foo needs to exist and be in your APP PATH. If blah.foo is not in your APP PATH, you get a "Procedure cannot be found" error (FOC227).

C) -INCLUDE [path]blah.foo
[path]blah.foo must exist.

D) -INCLUDE MYAPP/BLAH
blah.fex must be in myapp, however myapp does NOT have to be your APP PATH. It seems to work provided that either myapp is directly under your apps folder, or you can do an APP MAP on myapp.


Caveat #1: I did my testing on WF 7.68 on Wintel, your mileage may vary on other (in particular earlier) releases. If you're in doubt, consult the documentation for your environment.

Caveat #2: For A & D, I capitalized the app & filename to be consistent with the doc, but I believe these can be mixed case.

Caveat #2: I think someone else noted this, but to repeat, your -INCLUDE file should contain only legitimate WebFOCUS code. There is nothing to stop you from doing a -INCLUDE car.mas or car.foc.

EricH
May 26, 2009, 10:41 AM
Doug
Eric,
Regarding:
quote:
if you have ON TABLE SAVE AS MYCODE FORMAT DOC, and you have a mycode.fex anywhere in your APP PATH, the mycode.fex in your APP PATH executes.
At what point, in your "Example A", would mycode.fex get executed?
May 26, 2009, 03:09 PM
EricH
Hey Doug,

Maybe I'm not understanding your question, but the "execution" (notice the quotes) of an INCLUDE file is the same regardless of the precise phrasing of the -INCLUDE (my options A-D). A -INCLUDE behaves almost as if you had placed that code directly inside the fex.

As to the "execution", it depends on whther you're talking about the Dialogue Manager exection or the FOCSTACK execution. Any Dialogue Manager execution is immediate. Any non-Dialogue Manager statements inside the -INCLUDE are put on the FOCSTACK. If you have a -RUN inside the -INCLUDE, then any code on the FOCSTACK will execute, then the Dialogue Manager interpreter takes control again. Rinse, lather, repeat.

If you're familiar with Dialogue Manager concepts, then you should understand what I'm talking about. If you're not familiar with Dialogue Manager (i.e., if you have no idea what I was just talking about), then I suggest you read the existing documention on Dialogue Manager and possibly take a training course or two.

Or have I totally mis-interpreted your question? Red Face

EricH
May 26, 2009, 11:46 PM
Waz
The other way to remove the blanks, (On MF its for Print Control), is to write out a master to reread the file.

Also here is an example of Wrapping in PDF
DEFINE FILE CAR
 LINE_NO/I9 WITH COUNTRY = LAST LINE_NO + 1 ;
 LONG_LINE/A1000 = IF LINE_NO EQ 1
                   THEN 'EDA, EDA/SQL, FIDEL, FOCCALC, FOCUS, FOCUS Fusion, FOCUS Vision, Hospital-Trac, Information Builders, the '
                      | 'Information Builders logo, Parlay, PC/FOCUS, SmartMart, SmartMode, SNAPpack, TableTalk, WALDO, Web390, '
                      | 'WebFOCUS and WorldMART are registered trademarks, and iWay and iWay Software are trademarks of Information '
                      | 'Builders, Inc.'
                   ELSE
                   IF LINE_NO EQ 2
                   THEN 'Due to the nature of this material, this document refers to numerous hardware and software products by their '
                      | 'trademarks. In most, if not all cases, these designations are claimed as trademarks or registered trademarks by '
                      | 'their respective companies. It is not this publisher’s intent to use any of these names generically. The reader is '
                      | 'therefore cautioned to investigate all claimed trademark rights before using any of these names other than to refer '
                      | 'to the product described.'
                   ELSE
                   IF LINE_NO EQ 3
                   THEN 'Copyright © 2006, by Information Builders, Inc and iWay Software. All rights reserved. Patent Pending. This manual, '
                      | 'or parts thereof, may not be reproduced in any form without the written permission of Information Builders, Inc. ; '
                   ELSE ' ' ;
END
TABLE FILE CAR
 SUM LONG_LINE
 BY  LINE_NO NOPRINT
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
UNITS=CM, PAGESIZE='A4', LEFTMARGIN=0.635000, RIGHTMARGIN=0.635000,
    TOPMARGIN=0.635000, BOTTOMMARGIN=0.635000, SQUEEZE=ON,
    ORIENTATION=LANDSCAPE, $
TYPE=REPORT, GRID=OFF, FONT=TIMES NEW ROMAN, $
TYPE=REPORT, COLUMN=LONG_LINE, WRAP=28, $
ENDSTYLE
END



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!

May 28, 2009, 01:55 PM
Doug
Yeah EricH, I think you "mis-interpreted (my) question? ... At what point... ". It's not a non-understanding of DM on my part (as I've been doing this since close to its inception), but an understanding the scenario as it applies to the initial post (leading space, etc). This post seemed to have been hijacked beyond its original intend (filedefs, now dm, etc), as previously mentioned. So, I'll leave with that note as there seems to be enough information here to satisfy the initial question. Wink