Also, an addition that I forgot, the saved file should look something like
this:

type "Interview" name "Mama" nop "1" short "erpokgepokg" intro
"pokwporkpwork" url "pokpok" homepage "pokpok" date 28-Apr-2001 question1
"Blah" answer1 "Bloh" question2 "Blah" answer2 "Bloh" etc..

and it's loaded using: 

interview: load %filename.r

And so it can be displayed using

print interview/name
print interview/question1

etc...

/Regards Stefan Falk

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: den 29 april 2001 10:35
> To: [EMAIL PROTECTED]
> Subject: [REBOL] Re: Creating stuff :)
> 
> 
> That's not quite it, so here comes a quite lengthy 
> description of what I'm
> trying to do:
> 
> First, I have a form asking how many questions and answers 
> there is (the
> whole script is for adding an interview to a webpage, without 
> having to deal
> with HTML), this is then sent to a rebol script that prints 
> the following
> form (noq = number of questions):
> 
> ;--------------- Only a small part of the form
> for count 1 noq 1 [
> 
> print rejoin [{
>       <tr>
>               <td colspan="2">
>                       <font face="Verdana" 
> size="2"><b>Question } count
> {</b><br></font><textarea cols="60" rows="10" name="question} count
> {"></textarea><p>
>               </td>
>       </tr>
>       <tr>
>               <td colspan="2">
>                       <font face="Verdana" size="2"><b>Answer } count
> {</b><br></font><textarea cols="60" rows="10" name="answer} count
> {"></textarea><p>
>               </td>
>       </tr>
> }]
> ]
> ;--------------------------------
> 
> after that, this form is sent to another rebol script that will add
> everything to a file:
> 
> ;-------------------------------------------------------------
> 
> create-interview: func [][
> 
> noq: data/noq
> date: now/date
> name: data/name
> nop: data/nop
> short: data/short
> short: replace/all short newline "<br>"
> 
> intro: data/intro
> intro: replace/all intro newline "<br>"
> 
> 
> append feature-file 'type
> append feature-file type     ; type: data/type was done earlier in the
> script
> append feature-file 'name
> append feature-file name
> append feature-file 'nop
> append feature-file nop
> append feature-file 'short
> append feature-file short
> append feature-file 'intro
> append feature-file intro
> 
> url: data/url
> homepage: data/homepage
> 
> append feature-file 'url
> append feature-file url
> append feature-file 'homepage
> append feature-file homepage
> append feature-file 'date
> append feature-file date
> 
> 
> noq: to-integer noq
> 
> for count 1 noq 1 [
> 
> questionX: data/questionX
> answerX: data/answerX
> append feature-file 'QuestionX
> append feature-file questionX
> append feature-file 'AnswerX
> append feature-file answerX
> 
> ]
> 
> ;-------------------------
> 
> And then it goes on to save the file.
> 
> The problem is (I think) the way the form sends the data, as 
> it sends it
> with the name(s)
> question1
> question2
> question3
> etc.. 
> 
> answer1
> answer2
> answer3
> etc..
> 
> This mean that even if I know the number of questions, I still have to
> change the number in a line of code to get the data. (Maybe I 
> could use some
> sort of for loop to count through the data?)
> 
> After this I need a script to print the questions, which 
> would be easy to
> make if I can get this thing running. Hope this makes 
> everything clearer!
> 
> /Regards Stefan Falk
> 
> > -----Original Message-----
> > From: Mike Yaunish [mailto:[EMAIL PROTECTED]]
> > Sent: den 29 april 2001 01:15
> > To: [EMAIL PROTECTED]
> > Subject: [REBOL] Re: Creating stuff :)
> > 
> > 
> > At 04:58 PM 27/04/01 +0200, you wrote:
> > 
> > Are you maybe looking for something like this;
> >  >> question1: 0  ; initialize the word "question1"
> > == 0
> >  >> set 'question1 99
> > == 99
> >  >> print question1
> > 99
> > 
> > I think this may answer some questions - but probably not 
> > solve your problem.
> > In your example you are setting two variables when I don't 
> > think that is 
> > neccesary.
> >  From your example it looks like your real target action is 
> > to get the 
> > questions and
> > answers into the "file-to-save".
> > 
> > How about:
> > 
> > for count 1 number-of-questions 1 [
> >      ;question[count]: data/question[count]
> >      ;answer[count]: data/answer[count]
> >      append file-to-save data/question/:count
> >      append file-to-save data/answer/:count
> > ]
> > 
> > If you are using the psuedo variables "question[count]" and 
> > "answer[count]" 
> > somewhere
> > after the loop then you can just use normal variable 
> assignments like:
> > 
> > last-question: data/question/:count
> > last-answer: data/question/:count
> > 
> > because that is all that those variable will be holding after 
> > the loop anyway.
> > 
> > 
> > >Hi,
> > >that's good except for:
> > >
> > >** Script Error: question has no value. ** Where: set 
> question/:count
> > >data/question/:count
> > >
> > >I would like to set (for the first iteration)
> > >
> > >question1: data/question1
> > >
> > >and I guess
> > >
> > >set question/:count data/question/:count
> > >
> > >isn't quite the same,
> > >I don't want it in a block, but in a word or variable or 
> > whatever it's
> > >called in rebol :)
> > >
> > >/Regards Stefan Falk - www.amigaextreme.com
> > >
> > > > -----Original Message-----
> > > > From: Ingo Hohmann [mailto:[EMAIL PROTECTED]]
> > > > Sent: den 26 april 2001 22:19
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [REBOL] Re: Creating stuff :)
> > > >
> > > >
> > > > Hi Stefan,
> > > >
> > > > I thought I already saw the answer, but seems I just dreamt, so
> > > > here it is (translating your fantasy example to rebol, the way I
> > > > understand it ...)
> > > >
> > > > Once upon a time [EMAIL PROTECTED] spoketh thus:
> > > > > for count 1 number-of-questions 1 [
> > > > > question[count]: data/question[count]
> > > > > answer[count]: data/answer[count]
> > > > > append file-to-save question[count]
> > > > > append file-to-save answer[count]
> > > > > ]
> > > >
> > > > for count 1 number-of-questions 1 [
> > > >   set question/:count data/question/:count ; you have to use
> > > > set, question/:count: won't work
> > > >   set answer/:count data/answer/:count
> > > >   append file-to-save question/:count
> > > >   append file-to-save answer/:count
> > > > ]
> > > >
> > > >
> > > > kind regards,
> > > >
> > > > Ingo
> > > >
> > > > --
> > > > To unsubscribe from this list, please send an email to
> > > > [EMAIL PROTECTED] with "unsubscribe" in the
> > > > subject, without the quotes.
> > > >
> > >--
> > >To unsubscribe from this list, please send an email to
> > >[EMAIL PROTECTED] with "unsubscribe" in the
> > >subject, without the quotes.
> > 
> > Mike Yaunish
> > [EMAIL PROTECTED]
> > 
> > -- 
> > To unsubscribe from this list, please send an email to
> > [EMAIL PROTECTED] with "unsubscribe" in the 
> > subject, without the quotes.
> > 
> -- 
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the 
> subject, without the quotes.
> 
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to