Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Clip Needs to Write to two files

Expand Messages
  • Don Passenger
    So far I use this.... ^!Set %ITEMNO%=0 ... ^!Inc %ITEMNO% 1 ^!Set %HowManyChoices%=^?{How many Choices=1|2|_3|4|5|6|7|8|9|10};%Question%=^?{Question}
    Message 1 of 3 , Dec 14, 2000
    • 0 Attachment
      So far I use this....

      ^!Set %ITEMNO%=0
      :STARTTABLELOOP
      ^!Inc %ITEMNO% 1
      ^!Set %HowManyChoices%=^?{How many
      Choices=1|2|_3|4|5|6|7|8|9|10};%Question%=^?{Question}
      ^!IfCancel END
      ^!InsertHtml <TR>^P <TD>^P ^%Question%^P </TD>^P

      :STARTINPUTLOOP
      ^!Set %Output%=^?{Output};%VisableQuestion%=^?{VisableQuestion}

      ^!InsertHtml <TD>^P <INPUT TYPE="RADIO" NAME="ITEM_^%ITEMNO%"
      VALUE="ITEM_^%ITEMNO%|^%Output%" >^%VisableQuestion%^P </TD>^P
      ^!IfCancel ENDSTARTINPUTLOOP
      ;Here I Would Want to Write to Second File I think
      ^!Dec %HowManyChoices%
      ;if there is another input item this question, redo loop
      ^!IF ^%HowManyChoices% > 0 STARTINPUTLOOP
      :ENDSTARTINPUTLOOP
      ^!InsertHtml </TR>^P
      ;
      ;Go back to Start Table Loop for Next Question
      ^!Goto STARTTABLELOOP
      :END

      Do I need to have two files open...
      The first one is opened with the template file with this line:
      = DocTemplate ClipCode "Home%0.3d.htm"
      How do I open the second file.
      I have been searching through help...but I cannot find how to open two files
      with that line in a template.

      Or do I from within the clip (I am calling the above clip from the template
      file using ^!farclip function) create the second file and then open it from
      within the clip and then append to it on each loop iteration.

      ---
      Don Passenger
      Personal Page: http://www.iserv.net/~dpasseng
      Court Page: http://www.iserv.net/~dpasseng/grdc

      ...snip original post
    • Don Passenger
      Answering my own question I think.... ^!Set %SurveyName%=^$GetValue(SurveyName)$ ^!AppendToFile d: 1h 1grba bin survey ^%SurveyName%.srv AnyText Where any
      Message 2 of 3 , Dec 14, 2000
      • 0 Attachment
        Answering my own question I think....

        ^!Set %SurveyName%=^$GetValue(SurveyName)$
        ^!AppendToFile "d:\1h\1grba\bin\survey\^%SurveyName%.srv" AnyText
        Where any text will need to be replaced with my variables and text I need to
        output.

        This apparently writes it by appending to the existing file.
        Still need to put a safeguard so that it stops on first run through if the
        file already exists, as I don't want to append to an existing file on first
        iteneration. Thereafter, I will have a new file and want to go from there.

        ---
        Don Passenger
        Personal Page: http://www.iserv.net/~dpasseng
        Court Page: http://www.iserv.net/~dpasseng/grdc
        ----- Original Message -----
        From: Don Passenger <dpasseng@...>
        To: <ntb-clips@egroups.com>
        Sent: Thursday, December 14, 2000 10:54 PM
        Subject: [Clip] Clip Needs to Write to two files


        > I am attempting a clip which needs to generate two files.
        > I started by taking the html.tpl file and modifying it (saved under a
        > different name of course). It generates file number 1, which is an html
        > file. I start this renamed .tpl file by using a modified version of the
        > "New Web Page" clip in the HTML Library but pointing it to the renamed
        .tpl
        > file.
        >
        > I get to a point in the .tpl file where I need to generate a table...and I
        > am getting close to having this part work...
        > It needs to run through a loop where it asks me information and I need to
        > take that information and put it into a table cell...
        >
        > The output looks like this:
        > <TR>
        > <TD>
        > *Have you ever had a virus on your personal computer?*
        > </TD>
        > <TD>
        > <INPUT TYPE="RADIO" NAME="ITEM_1" VALUE="ITEM_1|**Had Virus**"
        >***Yes***
        > <INPUT TYPE="RADIO" NAME="ITEM_1" VALUE="ITEM_1|No Virus" >No
        > <INPUT TYPE="RADIO" NAME="ITEM_1" VALUE="ITEM_1|No Answer" checked>No
        > Answer
        > </TD>
        > </TR>
        >
        > I prompt for the *question*, **Had Virus**, ***Yes*** (the asterisks would
        > not appear in the actual content, but were placed as markers). This then
        > needs to loop for the next ITEM_1, until there are no more ITEM_1
        questions.
        > Once I ask the question, I ask how many Input Items there are for that
        > question, in this case there are three.
        > I think I can get that part with some trial and error.
        >
        > Here is my problem, I also need to take that same information and write it
        > to ANOTHER data file like this:
        >
        > ITEM_1|**Had Virus**:0:****Have had a virus****:
        > ITEM_1|No Virus:0:Have never had a virus:
        > ITEM_1|No Answer:0:No answer:
        >
        > The **Had Virus** part is the same bit of info, and the ****Have had a
        > virus**** part is another prompted question.
        > So after that lead in...how do I take the info in the variables and output
        > to a second file. Then I need to cycle back for question two writing to
        the
        > html file and then to the data file.
        >
        > Thanks for any help and suggestions.
        >
        >
        > ---
        > Don Passenger
        > Personal Page: http://www.iserv.net/~dpasseng
        > Court Page: http://www.iserv.net/~dpasseng/grdc
        >
        >
        >
        >
        >
      • Don Passenger
        I think I have arrived at success! What I was doing was creating a survey form and data file to utilize the survey script at http://www.bignosebird.com You
        Message 3 of 3 , Dec 15, 2000
        • 0 Attachment
          I think I have arrived at success!

          What I was doing was creating a survey form and data file to utilize the
          survey script at http://www.bignosebird.com

          You need to generate your own .html file (the form) and the .srv file (the
          database).

          My problem was I needed to set a variable and write to both the html file
          (which I have open) and to the .srv file which I needed to create and write
          to.

          My solution came from finding the append to file command.

          What I have done is test to see if the .srv file already exists, prompt to
          eliminate it on the first iteration (so that I am not appending to an
          existing file -- and I can abort if I choose not to delete it of course).

          After being sure there is no .srv file, then I use file append each time
          through the repeating loop:

          ^!AppendToFile "d:\1h\1grba\bin\survey\^%SurveyName%.srv"
          ITEM_^%ITEMNO%|^%Output%:0:^%VisableResult%:^%NL%


          I tried using ^P for carraige returns, but it didn't work. Fortunately Alan
          knew to use the ^%NL% feature and now I have it working.

          If it is something someone has interest in I can post it on the web for you
          to see in all of its depth.

          ---
          Don Passenger
          Personal Page: http://www.iserv.net/~dpasseng
          Court Page: http://www.iserv.net/~dpasseng/grdc
        Your message has been successfully submitted and would be delivered to recipients shortly.