[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Export Specific Columns and Rows
>Grant wrote:
>
>> > Well, what I'm looking to do is take the transaction table to create
>> >a specific probably CSV type file to use for importing. I like what the
>> >export
>> >function in the admin UI does except it dumps all rows and columns.
>> >Would the above example place commas between fields ? Thanks Mike.
>> >
>> >Jon
>>
>> I've had something like that set up so I can import the file it
>creates into
>> another program. It used a search to search for the right rows and then
>> just pulled data from the appropriate columns though. That might be an
>> easier way to go....
>>
>
> Did you use the SQL facility or what ? Can you give me a snippet of
>your code to work from ? Thanks.
>
>Jon
I don't use SQL yet. Thanks to Ed LaFrance, this code selects all pending
orders and exports certain fields of their's to a txt file:
[loop search="
co=yes
fi=transactions
st=db
tf=code
sf=status
se=pending
op=rm
nu=0
sf=deleted
se=1
nu=0
op=!~
"][tmp pending_order][scratch pending_order]"[loop-code]",
"[loop-data transactions fname] [loop-data transactions lname]",
"[loop-data transactions company]",
"[loop-data transactions fname] [loop-data transactions lname]",
"[loop-data transactions address1]",
"[loop-data transactions address2]",
"[loop-data transactions city]",
"[loop-data transactions state]",
"[loop-data transactions zip]",
"[loop-data transactions phone_day]",
"[loop-data transactions fname] [loop-data transactions lname]",
"[loop-data transactions email]",
"Thanks for shopping at TrippyStore.com!",
"Email = [data base=userdb field=email_copy key='[loop-data transactions
usernam
e]']",
"Res. = [loop-data transactions delivery_type]"
[/tmp][/loop]
[calc]
$Scratch->{pending_order} =~ s/\",\n/\",/g;
$Scratch->{pending_order} =~ s/\n/\r/g;
return;
[/calc]
[log
file="orders/pending/pending_orders.txt"
type=text
interpolate=1
hide=1
create=1
umask=022][scratch pending_order][/log]
Hope it helps!
- Grant