home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1996 / ARCHIVE_96.iso / discs / gerald / 6_06 / PipeEdit / ReadMe < prev    next >
Text File  |  1993-01-14  |  5KB  |  147 lines

  1. %OP%VS4.13 (28-Apr-92), Gerald L Fitton, R4000 5966 9904 9938 
  2. %OP%DP0
  3. %OP%IRY
  4. %OP%PL0
  5. %OP%HM0
  6. %OP%FM0
  7. %OP%BM0
  8. %OP%LM4
  9. %OP%PT1
  10. %OP%PDPipeLine
  11. %OP%WC1014,2262,44,1748,0,0,0,0
  12. %CO:A,72,72%
  13. %C%Database Manipulation
  14. %C%by Gerald L Fitton
  15. Keywords:
  16. Database King Brown Snow Fitton
  17.  
  18.  
  19. Roger King's Database Problem
  20.  
  21. DataBase
  22. Roger King has written to me with a problem which involves changing the 
  23. format of a database.  He has a number of records in a format similar 
  24. to the one below (four columns) with one record per row:
  25.  
  26. ColáAááColáBááColáCááColáD
  27.  
  28. What he wants to do is to change it to a format which uses two rows per 
  29. record but with only three columns:
  30.  
  31. ColáAááColáBááColáD
  32.        ColáC
  33.  
  34. Roger does not want to type all the records again but wants way of 
  35. transferring the data from his 'old' database to the new one.  I have a 
  36. very messy solution which uses a lot of memory using the index(,,) 
  37. function.  We would welcome a simpler solution.  Please write to me if 
  38. you have any ideas.
  39.  
  40.  
  41. Bruce D Brown Replies
  42.  
  43. I think the easiest solution is to use that wonderful, underrated 
  44. programme which comes with every Acorn machine i.e !Edit. 
  45.  
  46. I've put files giving a blow by blow account of the process on the 
  47. disc.  You can see the basic procedure is to use the facilities of 
  48. PipeDream to get the data into a form such that the search & replace 
  49. facilities of Edit can be used to give the desired result.
  50.  
  51. The order of reading the files is fairly obvious ie
  52.  
  53.    Original
  54.    Step 1
  55.    Step 2
  56.    Step 3
  57.    Step 4
  58.    Yipee!
  59.  
  60. I routinely use this sort of approach to solve all sorts of data 
  61. manipulation problems, often with MSDOS files.  The principles to 
  62. remember are:
  63.  
  64. 1. Nearly all databases and wordprocessors can export data as ASCII. 
  65.    (CSV is also very useful when numbers and text are involved.)
  66.  
  67. 2. PipeDream is marvellous for getting tabbed ASCII files into columns 
  68.    which allows the order of the data, both fields and records, to be 
  69.    changed at will using block moves and sorts.
  70.  
  71. 3. Virtually any search and replace operation can be carried out in 
  72.    Edit. This applies particularly to RISCOS 3 Edit and SrceEdit which 
  73.    have the more versatile Wildcard option as well as Magic characters.
  74.  
  75. Hope the above information helps Roger and maybe shines a little light 
  76. on that great double act,  "PD/Edit - the data manipulators".
  77.  
  78. 9th January 1993
  79.  
  80.  
  81.  
  82. Howard Snow replies to the problem in a similar way.
  83.  
  84. I read with interest the problem being experienced by Roger King.  It 
  85. seems to me that there is no real difficulty in performing the 
  86. conversion that Roger wants, provided that he does not restrict himself 
  87. to using only PipeDream during the conversion.  The Archimedes has some 
  88. very powerful utilities built-in, and they can complement PipeDream in 
  89. many ways.
  90.  
  91. The procedure to follow is detailed below.
  92.  
  93. [You can use the same database called [Original] - GLF]
  94.  
  95.  
  96. PROCEDURE
  97.  
  98. 1. Load the database file into PipeDream.
  99.  
  100. 2. Ensure that !Edit is loaded onto the icon bar.
  101.  
  102. 3. Save the database file as an ASCII file directly onto the !Edit 
  103.    icon.  (Note: it is necessary to use LF as the line separator 
  104.    when saving the ASCII file.)
  105.  
  106. 4. Press f4 (Find Text), and select Magic Characters. Enter \x0A as 
  107.    the 'Find' string, and \x0A\x0A as the 'Replace with' string.  
  108.    Select 'GO'.
  109.  
  110. 5. When the 'Text found' box appears, select 'End of File Replace'.  
  111.    When the search has completed, select 'Stop'.
  112.  
  113. 6. Press f3 (Save) and drag the 'save file' icon direct onto the 
  114.    PipeDream icon on the icon bar.
  115.  
  116. 7. Double-click on the 'Convert' command file on the disc.
  117.  
  118.  
  119. This produces a file in the format requested by Roger.  The procedure 
  120. assumes that the database file is not so big that a number of copies 
  121. cannot be held in memory at the same time.  If it is too big, then it 
  122. will be necessary to save the intermediate steps to disc (steps 3á&á6), 
  123. and close the original files as appropriate.  Then load the saved files 
  124. into !Edit (prior to step 4) or to PipeDream (prior to step 7).
  125.  
  126. The fundamental part of the Convert command file is on lines 7-12, 
  127. where it examines the database file after modification in !Edit, and if 
  128. it finds it is working in a blank line, it brings down the Column C 
  129. entry from the previous line.  This process is then replicated down for 
  130. the entire database.
  131.  
  132. Once the new columns (EátoáG) have been entered, the command file 
  133. converts these to a 'snapshot' (\BSS) and then deletes the original 
  134. four columns, leaving the new structure intact.
  135.  
  136.  
  137. Howard Snow
  138.  
  139. 31 Grizebeck Drive
  140. Allesley
  141. Coventry
  142. CV5 7PL
  143.  
  144. 10 January 1993
  145.  
  146. Fax-Phone : 0 203 405109
  147.