Subject Re: [IBO] Re: Blob update
Author Jason Wharton
Converting RTF to text is beyond the scope of the IBO list. I suggested that
you take advantage of the TIB_RichEdit control to accomplish that but this
is all I can think of to do to strip out the RTF markups.

Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "Bituin Bautista" <bituinb@...>
To: <IBObjects@egroups.com>
Sent: Wednesday, January 24, 2001 4:37 PM
Subject: RE: [IBO] Re: Blob update


> Thanks Jason,
>
> The notes is RTF . I've tried it also using 2 Cursor but the same
output
> results , with extra text. Pls look at the code.. maybe i'm doing
something
> wrong..I've tried also replacing fieldvalues with fieldbyname but still
the
> same results.. i'm stump. pls help
>
> Thanks again,
>
>
> procedure TForm1.ProcessNoteBusiness;
> var I,j: Integer;
> fieldi,connector,sqltext,new:string;
> begin
> try
> STemp:=TStringList.Create;
> SSource:=TStringList.Create;
> Stemp.Clear;
> Stemp.LoadFromFile(filedir+'BSetting.txt');
> connector:='';
> fieldi:='';
> sqltext:='select * from note where no_displayname in ';
> for I := 0 to (sTemp.Count-1) do // Iterate
> begin
> new:=copy(sTemp.strings[i],pos(' -> ',sTemp.strings[i])+4,
> length(sTemp.strings[i])); // coulumn in the target table
> StripChar(copy(sTemp.strings[i],1,pos(' -> ',sTemp.strings[i])-1));
> {spit oout the columns that i need from the settings, i'm mapping several
> colums from the source table into one column in the target table }
> for j := 0 to SSource.Count-1 do // Iterate
> begin
> fieldi:=fieldi+connector+'"'+SSource.strings[j]+'"';
> connector:=','
> end; // for
> sqltext:=sqltext+'(' + copy(fieldi,1,length(fieldi)) +') ' +
> 'and no_businessid is not null and no_note is not null';
> with qryNote do begin file://TIB_Cursor
> Close;
> SQl.Clear;
> SQL.Text:=sqltext;
> Prepare;
> end;
> while not qryNote.eof do begin
> STemp.Clear;
> with qryBusinessNote do begin ////TIB_Cursor
> Close;
> Prepare;
>
> params.paramvalues['bn_businessid']:=qryNote.fieldvalues['no_businessid'];
> Open;
> end;
> if qryBusinessNote.eof then begin
> qryBusinessNote.Insert;
>
>
qryBusinessNote.fieldvalues['bn_businessid']:=qryNote.fieldvalues['no_busine
> ssid'];
>
>
qryBusinessNote.fieldvalues[''+new+'']:=qryBusinessNote.fieldbyname(''+new+'
> ').asstring
> +#13 + qryNote.fieldvalues['no_note'];
> qryBusinessNote.Post;
> end else begin
> STemp.add(qryBusinessNote.fieldbyname(''+new+'').AsString) ;
> qryBusinessNote.Edit;
> qryBusinessNote.fieldvalues[''+new+'']:= STemp.text+
> qryBusinessNote.fieldbyname(''+new+'').asstring
> +#13 + qryNote.fieldvalues['no_note'] ;
> qryBusinessNote.Post;
> end;
> qryNote.Edit;
> qryNote.fieldvalues['no_tag']:='Y';
> qryNote.Post;
> qryNote.Next;
> end; // while}
> end; // for
> finally
> STemp.Free ;
> SSource.Free;
> end;
> end;
>
>
>
>
> -----Original Message-----
> From: Jason Wharton [mailto:jwharton@...]
> Sent: Wednesday, January 24, 2001 5:55 PM
> To: IBObjects@egroups.com
> Subject: Re: [IBO] Re: Blob update
>
>
> > how can i update a blob field using IBO ?. I want to insert a text at
the
> > beginning of the blob data, without using data aware components. here's
> the
> > code. Am i missing something.. help..
> >
> > the sql for the qryNote = Select * from note where no_businessid=44
> and
> > no_displayname='Chattels'
> > the fields no_note & bn_comment is a blob field
> >
> >
> > qryNote.Close;
> > qryNote.Prepare;
> > qryNote.Open;
> >
> > MyPictureColumnOld := TIB_Column(qryNote.FieldByName( 'NO_NOTE'));
> > with dsql do begin file://TIB_DSQL
> > sqltext:='Update businessnote set bn_comment=:bn_comment where
> > bn_businessnoteid=1';
> > SQl.Text:=sqltext;
> > Prepare;
> > MyPictureColumnNew:= DSQL.ParamByName('bn_comment');
> > MyPictureColumnNew.AsString :='test' +#13+
> > MyPictureColumnOld.Asstring;
> > ExecSQL;
> > end;
> >
> > here's the output if viewed in TWWDBRichEdit:
> >
> > test
> > {\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Arial;}{\f1\fnil Arial;}}
> > {\colortbl ;\red0\green0\blue0;}
> > \viewkind4\uc1\pard\cf1\lang1033\fs16 All light fittings\lang3081\f1\par
> > }
> >
> > i don't want all that extra text. All i want is this text to be
displayed
> > in TWWDBRichEdit:
>
> Are the notes originally in plain text or RTF? IBO doesn't have any
facility
> to convert RTF to plain text. I know that the TIB_RichEdit control can
have
> the PlainText property set to true such that it will recieve in the RTF
and
> then spit out just the plain text of the document. You might do well to
try
> manipulating things to do this.
>
> Also, let me caution you about a bug in InterBase that you may hit if you
> use the TIB_DSQL component and a SELECT statement. You can do what you are
> doing as long as you prepare and unprepare the statement every time it is
> executed. If you need to use an input parameter I recommend that you use a
> TIB_Cursor component and call the First method (which closes if open, and
> opens and fetches the first record). By doing it this way you avoid the
bug
> that it in the client API.
>
> Doing the Update as you are doing should be just fine.
>
> Another problem I just spotted is it appears you are expecting results
from
> the select to be obtained through the ParamByName(). THis will (should)
not
> work. I prefer that all output os acquired via the FieldByName() method.
>
> HTH,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
>
>
>
>
>
>