Another thing that I've done for a while now is to make sure that all
variables are defined and set to NULL prior to first use:

set var vText TEXT = NULL
set var vText = 'Your text'

rather than the single command:

set var vText TEXT = 'Your text'

It's a little bit of extra work - I put the first "null" definition at the
start of the command file so I can see all the vars together - but it seems
to have ensured the variable always <g> has the right type.

Jim, just out of interest, why the ... + ' ' + ... in your combined var
rather than ... & ...?

Regards,
Alastair.

----- Original Message ----- 
From: "Jim Limburg" <[EMAIL PROTECTED]>
To: "RBASE-L Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, August 29, 2003 9:08 PM
Subject: [RBASE-L] - Re: insert images


> Christian
>
> One other reccomendation.. I would construct the whole command
> into a text variable and then execute it with the ampersand...
>
> Like:
> SET VAR vm_cmd1 TEXT = 'INSERT INTO bilder (ut) VALUES'
> SET VAR vm_cmd2 TEXT =
'(['C:/inetpub/wwwroot/Hjortmar/formbilder/220.jpg'])'
> SET VAR vm_cmd TEXT = (.vm_cmd1 + ' ' + .vm_cmd2)
> &vm_cmd
>
> I have had a lot better luck running code like this, plus makes it easier
> to trace when you can see the value of vm_cmd just before it executes.
>
> I know some of the pure codists on this list would think it's a bit
> much to go this route, but as I said, I have had a lot better luck
> doing this, and besides, there have been some commands I have had
> to concatenate together in this fashion just to get it to work.
> They wouldn't work straight out.
>
> Jim Limburg
>
> Christian Hjortmar wrote:
> > Can a variable be used as value in a valuelist?
> >
> > This is what the manual says I should do and it works:
> > INSERT INTO bilder (ut)  VALUES
> > (['C:/inetpub/wwwroot/Hjortmar/formbilder/220.jpg'])
> >
> > but this is what I am trying to use:
> > INSERT INTO bilder (ut)  VALUES .vbild
> >
> > .vbild is a variable that contains the text
> > (['C:/inetpub/wwwroot/Hjortmar/formbilder/220.jpg'])
> >
> > I would like to insert images in my database and the images are all in
> > the same directory.
> > Being a lazy boy I figured out the following code.
> >
> > This is my little eep:
> >
> > SET VAR vtal INTEGER = 219
> > SET VAR vbild TEXT = ' '
> > SET VAR vbildfil INTEGER = 1
> > SET VAR vfram TEXT = '(['
> > SET VAR vbak TEXT = '])'
> > SET VAR vparfr TEXT = '
> > SET VAR vparbak TEXT = '
> >
> > WHILE vtal < 16500 THEN
> >
> >   vbild = 'C:/inetpub/wwwroot/Hjortmar/formbilder/' + (CTXT(.vtal)) +
'.jpg'
> >   vbildfil = (CHKFILE(.vbild))
> >   vbild = .vfram + .vparfr + 'C:/inetpub/wwwroot/Hjortmar/formbilder/' +
> > (CTXT(.vtal)) + '.jpg' + .vparbak + .vbak
> >   IF vbildfil = 0 THEN
> >     vbild = .vbild
> >   ELSE
> > ---***    INSERT INTO bilder (ut)  VALUES
> > (['C:/inetpub/wwwroot/Hjortmar/formbilder/220.jpg']) ***---
> > ---*** A variable containing the same thing as the text above does not
> > work in an insert command !!! ***---
> >     INSERT INTO bilder (ut)  VALUES .vbild
> >   ENDIF
> >
> >   SET VAR vtal = (.vtal + 1)
> > ENDWHILE
> > RETURN
> >
> >
> > Regards from Christian Hjortmar
> > + 46 46 2119142
> >
>
> --- RBASE-L
> ================================================
> TO POST A MESSAGE TO ALL MEMBERS:
> Send a plain text email to [EMAIL PROTECTED]
>
> (Don't use any of these words as your Subject:
> INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
> REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
> ================================================
> TO SEE MESSAGE POSTING GUIDELINES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message SUBJECT, put just one word: INTRO
> ================================================
> TO UNSUBSCRIBE:
> Send a plain text email to [EMAIL PROTECTED]
> In the message SUBJECT, put just one word: UNSUBSCRIBE
> ================================================
> TO SEARCH ARCHIVES:
> Send a plain text email to [EMAIL PROTECTED]
> In the message SUBJECT, put just one word: SEARCH-n
> (where n is the number of days). In the message body,
> place any
> text to search for.
> ================================================
>

Reply via email to