0
Votes
Undo
  1. Andrew Davis
  2. PowerBuilder
  3. Friday, 3 December 2021 15:00 PM UTC

Hi,

Hopefully someone can help.  

I want to store notes - rich text notes in my database table - i am using sql anywhere 16 and pb2019

Basically I want to add some notes in a customer record - save them - retrieve them and edit again 

What datatype do i use in the database ? 

And how do i get the data from the database to edit it - should i edit in a datawindow ? or a rich text edit ?

I think this should be simple but i am struggling with the whole process. Any help even if it seems obvious would be greatly appreciated.

regards and thanks in advance

Andrew

 

 

Who is viewing this page
Andrew Davis Accepted Answer Pending Moderation
  1. Monday, 6 December 2021 15:34 PM UTC
  2. PowerBuilder
  3. # 1

Chris

Thanks for that.

Question once i get the blob from the database, how do i assign it to the Rich Text Control ?

  • Load the RTF data into either a RT DWO or RTE Control

how do i convert the blob to string ?

And then how do i put it back ? do i use the following code - converting the string to blob

string ls_notes

blob lblb_blob

ls_notes=ret_1.copyrtf()

lblb_blob=blob(ls_notes)

then use updateblob - sql command

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 4 December 2021 14:37 PM UTC
  2. PowerBuilder
  3. # 2

Since you are using SqlAnywhere, when updating your data, always use an embedded UPDATEBLOB statement. Don't even think of trying to update your blob field by doing an Update() on the datawindow which might contain the blob field.

See https://www.appeon.com/standardsupport/search/view?id=2204

regards.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 3 December 2021 16:48 PM UTC
  2. PowerBuilder
  3. # 3

Hi Andrew;

  • You would use a Blob column in SA - which is the Long Binary data type in SA
  • Use the SelectBlob PB command to retrieve the Blob (RTF) data
  • Load the RTF data into either a RT DWO or RTE Control
  • Use the UpdateBlob command to insert / update the RTF based Blob data in SA.

HTH

Regards ... Chris

Comment
  1. Andrew Davis
  2. Monday, 13 December 2021 17:47 PM UTC
Chris



Sorry - how do i convert the blob stored on the database to a string ?

pastertf need a string parameter - i think
  1. Helpful
  1. Miguel Leeuwe
  2. Monday, 13 December 2021 19:52 PM UTC
Use the String() function.
  1. Helpful 2
  1. Andrew Davis
  2. Tuesday, 14 December 2021 10:15 AM UTC
thanks - i feel a bit stupid not realising that !!

  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Friday, 3 December 2021 15:58 PM UTC
  2. PowerBuilder
  3. # 4

varchar(32000) or whatever your max size would be.

then:

 

Defining edit styles - - Users Guide (appeon.com)

https://docs.appeon.com/pb2019/pbug/ch21s07.html#d0e40077

Comment
  1. Andrew Davis
  2. Tuesday, 7 December 2021 08:51 AM UTC
Mike



This is a very different option to Chris, using text rather than blob.

Would i copy the varchar - to the RTE by the copy RTE control ?
  1. Helpful
  1. mike S
  2. Tuesday, 7 December 2021 14:04 PM UTC
this approach uses the rich text edit style of a datawindow column.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


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