1. Andrew Davis
  2. PowerBuilder
  3. Friday, 15 March 2019

Hi, I do hope someone can help

 

I need my application to be able to send standard letters to selected customers on my database.

I am wondering what is the best way of going about this ? 

 

currently using pb2017 r2

 

regards

 

Andrew

 

 

 

 

Miguel Leeuwe Accepted Answer Pending Moderation
0
Votes
Undo

In word (2016) you go to the "Mailings" > "Select recipients" > "Use an existing List" and then you can choose from a variety of options: odbc datasources, text files, etc. 

Once you have done that, you can choose "Mailings" > "Insert Merge Field".

regards,

MiguelL

Comment
There are no comments made yet.
  1. Monday, 6 May 2019
  2. PowerBuilder
  3. # 1
Andrew Davis Accepted Answer Pending Moderation
0
Votes
Undo

Hi, thanks for all your help on this so far.

My application now has the RichText letter functionality i was after. 

I still have one question and maybe i am missing something obvious.

How do i add a 'column' field using Word as my rich text editor. I can add the columns using powerbuilder runtime, rte_1.InputFieldInsert ( "custname" )

however my user wants to be able to do it within word. 

 

If i open the RTF file creating in the datawindow or Rte control with in word, the field areas just show as a shaded ( grey background ) single character space, so they cant even see what field it is. 

 

As always any help is much appreciated  

regards

Andrew

Comment
There are no comments made yet.
  1. Friday, 26 April 2019
  2. PowerBuilder
  3. # 2
Olan Knight Accepted Answer Pending Moderation
0
Votes
Undo

Here's another approach:
~~~~~~~~~~~~~~~~~~~~~~~~~

RTF into a Word DOC


Thank you!
I see the trick is to save the text contect back into the database first and then retrieve it again and savedocument. I will do that if I have to. Right now I am talking with the users about doing all edits in the rich text first and then save it as PDF.

Ben

--------------------------------

 
yes, all inputfield data are there, for .doc or .rtf document.

from window

// Copy the entire contents of the RTE control to the order_document field.
ls_text = rte_order.CopyRTF(FALSE, Detail!)
inv_tm_order.EVENT doj_SetRecordItem('order_document', ls_text) --- ls_text will be saved in the database as long raw field

ls_text then pass to a function ue_pastetext in rte object which inherited from u_rte

// Write the text to a file for inserting in the RTE control.
li_ret = inv_filesrv.of_FileWrite(is_PathName + 'template.rtf', as_text, FALSE)

// i tried with .doc as well here
// li_ret = inv_filesrv.of_FileWrite(is_PathName + 'jd.doc', as_text,
FALSE) and check the .doc file all inputfield data are there. but i have
to user rtf as i am using InsertDocument command

// Set insertion point at start of RTE control
THIS.SelectText(1,1,0,0)

// Insert template document from file.
li_ret = THIS.InsertDocument(is_PathName + 'jd.doc', TRUE, FileTypeRichText!)
IF li_ret = -1 THEN error.of_abort('InsertDocument', ls_loc, 'template.rtf')



Jenny Diep
CourtView Technical Operations , Courts Technology Group



------------------------------




we have rtf control on window, the rtf document is stored in as long raw
field in oracle data base, so when user enter inputfields, the template
can be saved and retrieve for updating, the whole document only convert to
pdf when user indicates the document is completed and save as blob in
oracle database

Jenny Diep
CourtView Technical Operations , Courts Technology Group

---------------------------



Thanks Jenny. Yes, saving the rich text as PDF works OK for me, but I'd
like to save it as Word doc so users can edit it if necessary. Right now
when I save it as a Word doc (FileTypeDoc!), it only saves the original
text from the template itself and none of the input fields data populated
at runtime are not saved. The PDF saves all of those. I may just have to
tell the users to edit all they need in the rich text control. They are
going to replace these PB apps in two or three years anyway. But I think
SAP should improve this area - make PB more word-processing friendly. I
think most apps need that. Just some basic word-processing features and do
not have to be MS Word like. And speaking of that, I have to write some
database functions and triggers to format lots of "comments, notes,
descriptions" fields, because PB does not have word wrap with the regular
edit style on a text. When users forget to press the enter key, the text
becomes a long line, and
without reformatting, they will be cut off when printing on 8.5 x 11.

Ben

----------------------


Hi, Dazhi, in our application, we have 3 rtf templates, 1 for header, 1
for text and 1 for footer. at run time user will enter details in text
template with many inputifields, when it is complete, system will merge
header, text and footer as one document and convert it into pdf and in
database as blob field. some of the steps for merging 3 templates
together are

// Copy the entire contents of the RTE control to the order_document
field.
ls_text = rte_order.CopyRTF(FALSE, Detail!)
inv_tm_order.EVENT doj_SetRecordItem('order_document', ls_text)

// Write the text to a file for inserting in the RTE control.
li_ret = inv_filesrv.of_FileWrite(is_PathName + 'template.rtf',
as_text, FALSE)

// Insert template document from file.
li_ret = THIS.InsertDocument(is_PathName + 'template.rtf', TRUE,
FileTypeRichText!)

hope it helps

Jenny

----------------------------------

 
This is what I have done: I use a separate rich text edit control to create some templates (with those input fields I mentioned), save them into a database table (CLOB and insert into clob_table (id, clob) values (123, empty_clob()) - this is for Oracle; not sure how SQL Server/Sybase/others handle it - UpdateBlob ). On another rich text edit, I use SelectBlob to get the saved template and then pastRTF() to fill the edit control text (could also save the clob text into a file and then insert document). It has been working since 2008 and did not have to "save" the content until now. We just needed to print the text (form letters). Now they want to save the context into a file, edit it if needed, and then attach the file into a case's document repository.

Thanks.

Ben

________________________________

 
On the Breck Carter's page there's one thing that makes me be in doubt (between ""):

Unlike the DataWindow painter, PowerBuilder offers no way to paint the contents of a RichTextEdit control "in the development environment. You must actually write and run a program", or use some other RTF-capable product.

Does he mean it doesn't work from interpreted PB execution and does work having created an executable and running it ????
I don't think so ... but I'll try to find out.

good night!
Miguell

---
>
> Tomorrow, if I'll have some time I'll try to do this myself, but I think the fields should be also saved.
>
> Are you sure your file extension is ".rtF" (not .rtE, though as dumb as I might sound?)
>
> check out this page (oldie) from Breck Carter, maybe it might help:
>
> http://www.bcarter.com/tip036.htm
>
> regards,
> Miguell
>
> ---
> >
> > Hi Ben,
> >
> > Very funny, doesn't make sense!
> >
> > But ...
> > 1) Maybe you could use "CopyRTF()" instead:
> > That command, is supposed to copy everything selected, including fields(). (No clipboard involved!)
> > So the "selected" contents, you could copyRFF() and then paste into a document that you previously opened using OLE ????
> >
> > 2) Maybe, depending on what version of PDF programme you are using, you could use the SaveDocument() as PDF and then (through OLE command) do some kind of a "SaveAs()" from the PDF to other fileformat????
> >
> > Hope it helps.
> >
> > Miguell
> >
> > ---
> > >
> > > Hi all,
> > > I need to save the text in a RichTextEdit control's formated text into a .doc or .rtf file, using the SaveDocument (filename, FileTypeDoc!/FileTypeRichText!). But it only saves the original text on the template. I have many input "Fields" created using the InputFieldInsert method and they are populated at runtime. None of the input fields' data can be saved in the .doc or .rtf file. However, FileTypePDF! works OK and it saves everything from the input fields. Of course the problem with the PDF is that the users cannot edit anything. Does anyone have any idea why saving the content as a .doc/.rtf file is not saving the inout fields data? I am using PB 12.1 classic.
> > >
> > > Thank you.
> > >
> > > Ben
> > >

Comment
There are no comments made yet.
  1. Monday, 18 March 2019
  2. PowerBuilder
  3. # 3
Olan Knight Accepted Answer Pending Moderation
0
Votes
Undo

Here's a quick easy way to merged database data into a form letter; from a previous post:


http://groups.yahoo.com/group/PowerObject/files/PowerBuilder/PB6-DWTabular-MailMerge.zip


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Olivier/Ben/SP...

If you can live with unformatted/plain text for the
message in the letter/mail (while you can have other
fonts/formatting for rows/columns/text-objects), we
can create a mail-merge report using a simple tabular
dw with Computed-Fields! I've done this SEVERAL times
to put multiple rows on a single page report merging
the message "nicely" with other columns from table.
Here is a datawindow layout template:

POWERSOFT, INC.
Emeriville, CA
Phone: (800) 123-1234
email: info@powersoft.com
website: www.Powersoft.com
=============================================================
-------------------------------------------------------------
Header-band
-------------------------------------------------------------

"Date: " + String( Today())

[Name]
[Address]
[City] + ", " + [State] + " " + [Zip]

"Dear Sir/Madam:"

"On going through our records, your account shows a balance" + &
" of $" + String( [Balance_Amount] ) + " that is over-due. " + &
"It is imperative that you call us on or before " + &
String( [Deadline], "dd-mmm-yy" ) + " and make payment-" + &
"arrangements for this amount."

"Here are the details of the above balance amount:"

INVOICE         DATE             AMOUNT
-------------------------------------------------------------
1: Header Group Cust_ID
-------------------------------------------------------------

[Inv_No]       [Inv_Date]        [Inv_Amount]
-------------------------------------------------------------
Detail-band
-------------------------------------------------------------

"Total: " + String( RowCount())  Sum( Inv_Amount FOR GROUP 1)

"However, if you have already sent in your payment " + &
"for the above balance please accept our appologies " + &
"and disregard this notice."

"Yours truly, ~r~n~r~n~r~nPOWERSOFT, INC."
-------------------------------------------------------------
1: Trailer Group Cust_ID
-------------------------------------------------------------
-------------------------------------------------------------
Summary
-------------------------------------------------------------
"Printed on: " + String( Today(), "DD-MMM-YY HH:MM am/pm" )
-------------------------------------------------------------
Footer
-------------------------------------------------------------


You know very well how the above layout would look when
displayed/printed - just like a 'regular' letter!
Because we know DataWindow is a MAGIC!!!

You can include/embed anything in the computed-fields
including Retrieval-Arguments, dw-functions, computed-
columns, other columns... and format a meaningful
message. You can even use a single computed-field for
an entire band using CRLFs (~r~n) (except the detail
band). You can use large/bold fonts for headers such
as the Company title (POWERSOFT, INC. above), Summary
columns...

Hope this helps...

---

> > >
> > > Hi,
> > >
> > >   Using PB6.5 & Sybase.
> > >
> > >   Is it possible to perform retrieval of data from multiple DWs
> > (Freeform Presentation Style) and concatenating these data into a
> > single RTE Control?
> > > I checked out the PB example, and generally a pre-formatted
> > document template isused with the rte_1.DataSource(dw_1). This way
> is
> > no good to me as the data retrieved varies in number of rows thus
> the
> > placement of the data in the format of the document template is
> > totally out.
> > >
> > >
> > > I need these data to be saved in a file so that it can be email
> out
> > as a file attachment.
> > >
> > >
> > >   I'm really stuck here and appreciate any help on this. If RTE
> > cannot be used to perform this task, what other alternatives is
> > there?
> > >
> > >
> > > TIA, sp

Comment
There are no comments made yet.
  1. Monday, 18 March 2019
  2. PowerBuilder
  3. # 4
Andrew Davis Accepted Answer Pending Moderation
0
Votes
Undo

Does anyone have any example RichText code ?

Comment
Hi Andrew;

If its the RichText control that you are looking for an example: Have a look at my OrderEntry application and run the "Company Letter Generation" for the App's main menu / toolbar.

FYI: https://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry/

The App & the RTE functionality will run in Native (32/64bit), Dockable, IWA and PowerServer Web or Mobile deployments.

HTH

Regards ... Chris

  1. Chris Pollach
  2. Monday, 18 March 2019
Chris



Hi, thanks for this, where do i get the database to test the code with please.



regards

Andrew

  1. Andrew Davis
  2. Thursday, 21 March 2019
My example just imports an RTF file as the template. There is no DB.



However, store the RTF file in a DB Table in a Blob column and then change my example code to get the RTF template from any DB using PB's SelectBlob command. Then paste the RTF data from the Blob into the RTE control (instead of reading the RTF file like I do currently). If you want to update the template ... use PB's UpdateBlob to command send the RTF template data back into the DB's Blob table.



HTH
  1. Chris Pollach
  2. Thursday, 21 March 2019
There are no comments made yet.
  1. Monday, 18 March 2019
  2. PowerBuilder
  3. # 5
Miguel Leeuwe Accepted Answer Pending Moderation
0
Votes
Undo

If you decide to use the RTE dw or control, make sure you store you data in a BLOB field. There are lots of issues when saving the RTE format in a normal text field.

Comment
How would i do that ? - store in a blob field - i am using SQL Anywhere 16
  1. Andrew Davis
  2. Monday, 18 March 2019
Hi Andrew;

In SA - one would define the "Blob" column as LONG BINARY.

Regards ... Chris
  1. Chris Pollach
  2. Monday, 18 March 2019
There are no comments made yet.
  1. Monday, 18 March 2019
  2. PowerBuilder
  3. # 6
René Ullrich Accepted Answer Pending Moderation
0
Votes
Undo

If you need more features you can also use mail merge feature of Microsoft Word.

Comment
There are no comments made yet.
  1. Monday, 18 March 2019
  2. PowerBuilder
  3. # 7
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Andrew;

   FWIW: That is what the RichText DataWindow is all about!   wink

HTH

Regards ... Chris

Comment
Chris



Thanks, I have read that there are problems with rich text on pb2017 r2, what are they ?
  1. Andrew Davis
  2. Friday, 15 March 2019
The main problems have been related to using the new TE Control (under the hood) to render the Rich-text Control and Rich-text DataWindow RTE features. The TE control behaves a little different that the TX Control that Sybase used to use in their PB Versions.

The great news is that Appeon has now given PB developers *both* the TE and TX Control included for free in the PB2017R3 MR01 release (build 1880). So now if your mail merge DWO does not behave the exact way you need it. You can switch back & forth between the 3rd party RTE mechanisms with one change of the Application Object's RTE property.

So the big thing that you might want to think about is whether to move to the latest build of PB2017R3 before trying the RTE DW (to give you more flexibility to design and/or tweak with) RichText wise.

Food for thought. ;-)
  1. Chris Pollach
  2. Friday, 15 March 2019
There are no comments made yet.
  1. Friday, 15 March 2019
  2. PowerBuilder
  3. # 8
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.