[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-recutils] [help-recutils] :cmdline option in ob-rec usage
From: |
Jose E. Marchesi |
Subject: |
Re: [bug-recutils] [help-recutils] :cmdline option in ob-rec usage |
Date: |
Mon, 08 Jun 2015 17:24:07 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> > | Name | Address | Address_2 | City |
> >
|-----------------+-------------------------+-------------+---------|
> > | This is Person1 | 123 Some Street | |
Anytown |
> > | This is Person2 | 456 Another Lane | |
Anytown |
> > | This is Person3 | 789 Whatever Blvd | Apartment A |
Anytown |
> > | This is Person4 | 001 AndStillAnother Ave | |
Anytown |
> >
> > Am I using the :cmdline option correctly?
>
> :cmdline actually does nothing. You must use :fields instead, like in:
>
> #+begin_src rec :data Testrec1.rec :type Contact :fields
Name,Address[0-1],City
> #+end_src
>
>
Slowly something is penetrating my skull - essentially in ob-rec.el
:fields is used as conditional and if true concat the print function
for each field called- correct?
No. :fields accepts a FEX (fields descriptor) exactly like the -p
command line option.
However, the resulting column order depends upon when the fields are
first encountered as ob-rec.el works its way through each record in
the rec:type, i.e. if "This is Person3" is the first record, I get the
desired result; otherwise the original example the table column order
is as follows
| Name | Address | City | Address_2
|
|-----------------+-------------------------+---------+-------------|
| This is Person1 | 123 Some Street | Anytown | |
| This is Person2 | 456 Another Lane | Anytown |
|
| This is Person3 | 789 Whatever Blvd | Anytown | Apartment A
|
| This is Person4 | 001 AndStillAnother Ave | Anytown |
|
Is there a way of sorting the output so that the table columns are in
the order given in :fields?
Hmmm, that is a consequence of how rec2csv works internally. You see,
ob-rec.el uses rec2csv underneath. Let me take a look to that...