Thursday, December 1, 2016

Glueing Lines using Qedit

Glueing Lines

Occasionally we get requests to summarize data or manipulate reports to be re-organized. One common manipulation is to stick the contents of one line onto the end of another based on the a value in the first line. The commands to do this are fairly simple :


Append "~" "Transaction"
Glue "~"
ch "~" " @
     
Here is the data:

qux/lq all
Transaction Date: 20160908
 Balance: 1245.85
Transaction Date: 20151213
 Balance: 908.54
Transaction Date: 20121221
 Balance 125.44
Here is the code in action:

qux/append "~" "Transaction"
    1     Transaction Date: 20160908~
    3     Transaction Date: 20151213~
    5     Transaction Date: 20121221~
3 lines appended to
qux/glue "~"
    1     Transaction Date: 20160908~Balance: 1245.85
    3     Transaction Date: 20151213~Balance: 908.54
    5     Transaction Date: 20121221~Balance 125.44
3 lines Glue-updated
qux/ch "~" " @
    1     Transaction Date: 20160908 Balance: 1245.85
    3     Transaction Date: 20151213 Balance: 908.54
    5     Transaction Date: 20121221 Balance 125.44
3 lines changed

The Append command sticks a Tilde on the end of the line, and the glue command, glues the line after the Transaction line onto the end. Tilde is used since it isn't often in normal files, you can look to insure that the tilde is not in the file with a simple: ch "~"~" @, to see if there are any occurences.

Glu

No comments:

Post a Comment