Member export Options
howard
Posted: Wednesday, November 07, 2007 11:10:33 AM
Rank: Devotee

Joined: 8/22/2006
Posts: 72
Hi, one of our clients has requested an export tool to be added into umbraco CMS to export all members and member data for use in sales logix (sage CRM).

They have thousands of registered members in the database and 3 different member types and wish to export by member type and member group.

I initially thought sql to output a csv but could using base and outputting to a file be a better option?, maybe even xml (if sales logix supports it)

If anyone has any experience with this or would like to share any code i would be very grateful. If not, we can find a solution and post it back for other users.

thanks in advance.

Howard.
tim
Posted: Wednesday, November 07, 2007 12:14:35 PM

Rank: Addict

Joined: 2/19/2007
Posts: 819
Location: Belgium
Hi,

I found that exporting the members to xml with the umbraco api is a bit slow, a faster way is to wright a custom query.

http://forum.umbraco.org/extending-umbraco/export-members-to-xml---looking-for-a-faster-way

Greets

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
jesper
Posted: Wednesday, November 07, 2007 12:15:36 PM

Rank: Administration

Joined: 7/25/2006
Posts: 425
Location: vipperoed, denmark
Hi Howard,

My approach was to develop a library extension that could fetch members of a group and then use a xslt macro on a password protected page to format the output. Easy and flexible.

Extension code:

Code:

public static XPathNodeIterator MembersGetGroupMembersOf(int MemberOf)
        {

            XmlDocument doc;

            try
            {

                Member[] members = Member.GetAll;

                System.Text.StringBuilder sb = new System.Text.StringBuilder();

                foreach (Member m in members)
                {

                    if (MemberOf == 0)
                    {
                        XmlDocument mx = new XmlDocument();
                        sb.Append(m.ToXml(mx, false).OuterXml);
                    }

                    else if (m.Groups.ContainsKey(MemberOf))
                    {
                        XmlDocument mx = new XmlDocument();
                        sb.Append(m.ToXml(mx, false).OuterXml);
                    }

                }
                doc = new XmlDocument();

                doc.LoadXml("<memberlist timestamp=\"" + DateTime.Now.ToString("s") + "\">"
                    + sb.ToString() + "</memberlist>");



            }
            catch (Exception e)
            {

               // doc = utils.Helpers.XmlError("MembersGetGroupMembersOf", e);

            }
            return doc.CreateNavigator().Select(".");
        }


Example xslt which generates an ul list:

Code:



<xsl:variable name="membersofgroup" select="jesper.utils:MembersGetGroupMembersOf(1061)"/>

<ul>
    <xsl:for-each select="$membersofgroup//node [number(data [@alias='customAmount']) > 0]">
      <xsl:sort select="@updateDate" order="descending"/>
      <li>
      <xsl:value-of select="@nodeName"/>, <xsl:value-of select="@email"/> (<xsl:value-of select="data [@alias='customField']"/>)


</li>
    </xsl:for-each>
</ul>


Kindly,

Jesper

webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP / umbraco certified
jesper
Posted: Wednesday, November 07, 2007 12:16:55 PM

Rank: Administration

Joined: 7/25/2006
Posts: 425
Location: vipperoed, denmark
Mail me if you wan't the code without the wink.gif stuff ... jesper at jesper.com

webbureau jesper.com doing webdesign / development / umbraco implementations / 2007&2008 MVP / umbraco certified
howard
Posted: Wednesday, November 07, 2007 2:53:01 PM
Rank: Devotee

Joined: 8/22/2006
Posts: 72
wow, thats great.. thanks for the info. I will look into this, shame their crm can't hanlde xml..!
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.