add a column to the export

Discussion in 'Customization & add-ons' started by gailc, May 14, 2008.

  1. gailc

    gailc New Member

    Joined:
    Aug 30, 2007
    Messages:
    4
    Hi Alex,

    How do I add a column to the export, showing the number of payments a user has made. (like you show in the browse users dialogue)

    Gail
  2. calisolllc

    calisolllc Member

    Joined:
    Feb 19, 2007
    Messages:
    194
    Its not as simple as it may appear.
    The export basically traverses the member file and outputs all the records.

    Payments are in a separate file that relates to the member file in a many to one relationship (n:1) and is keyed to the member file by member ID.

    So the export query would need to be completely rewritten to traverse the payment file rather than the member file based on member id order, accumulating number of payments and subtotalling those for each member and each at each subtotal break, lookup and output the related member file record along with the total number of payments.. This would mean an ALMOST TOTAL rewrite of the export code

    Having said that IF you only have ONE product (a standard membership site) with lets say monthly subscriptions then perhaps a DIRTY way of adding that extra field would be to use the standard export code and look at the date of joining , extract the month and calculate number of months of membership (normally this = no of payments). The problem with this scenario is a member that doesnt pay for three months and is shut out of his/her subscription and then renews after a few months. Then this method would give false results
  3. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    <removed double post>
  4. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    Depending on what you are wanting the data for.

    If for just one time for your own reporting you can export all data as CSV and filter in Excel

    Code:
    ensure username is a selected export value, ensure product name and amount are selected export values, select All subscriptions, output additional for each payment, set delimiter to comma
    If it is a programmatic access for something the user sees, using the session values for the logged in user is an easy option.

Share This Page