Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

.NET or VBA Code Example to export SmartList Data into a CSV File

Posted on by Microsoft Employee

Hi,

I have been searching for a .NET (Visual Studio Tools) or VBA (Modifier) Code example which demonstrates how to export SmartList Data into a CSV File, but without success. Would anyone know where to find such an example? Otherwise, would someone know how to loop through the records found in a specific SmartLit?

Thank you for your time.

Regards,

Joseph

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: .NET or VBA Code Example to export SmartList Data into a CSV File

    Thank you again Joshua. We are currently still on Version 10 with no access to SSRS. We could use your suggested SSRS option once we have upgraded to the latest Version. Meanwhile, the difference between SSRS Reports and SmartLists, is that users can add columns in SmartLists, which would be automatically included in the Export (contrary to SSRS Reports, which would need to be modified, unless there is a functionality with which I am not familiar). The requirement from users is to have the ability to export directly to csv files, without having to go through Excel.

    Thank you.

    Regards.

    Joseph

  • Josh P Profile Picture
    Josh P 2,895 on at
    RE: .NET or VBA Code Example to export SmartList Data into a CSV File

    Joseph,

    Using a SaaS model deployment with GP is common, and SSRS reports (built into GP) have access to the database, and they use both the GP security model and SQL security. These can be limited to specific company databases, and the user (or group) security policies can be managed on the SQL side to prevent access to unauthorized tables.

    If this is not a viable solution, the easiest way to get a CSV file from Smartlist is to export it to Excel and save it as a CSV.

    You could even use an Excel macro to perform a Save As CSV using VBA code, and assign this macro to run on the Smartlist report after export. This is in Smartlist under the menu option SmartList > Export Solutions.

    Thanks,

    Joshua Pelkola

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: .NET or VBA Code Example to export SmartList Data into a CSV File

    Hi Joshua,

    Thank you for your reply. We have deployed Dynamics GP in a Hosted Environment, in which each legally independent entity has its own Company Database (but using a common unique Dynamics Database for all the Organizations). The Organizations do not have, and cannot be granted, access to the Databases directly, but must use the Dynamics GP Client, for security reasons and as a policy. Also, if one would connect directly to the Database, one would not have the ability to use Dynamics GP’s Security Model. The SmartLists used are the default ones, eventually customized using the built-in functionality, but not the Builder. Some Organizations would like to have the SmartList Data exported to a csv file.

    Thank you again.

    Regards,

    Joseph

  • Josh P Profile Picture
    Josh P 2,895 on at
    RE: .NET or VBA Code Example to export SmartList Data into a CSV File

    Hi Joseph,

    Curious to know why you want to export via Smart List when there are much faster options available. If you are looking for a quick way to do this, write a SQL query for the data you are exporting, and create an Excel Builder report. You can easily make this csv data, and it can be automated. Another way is to use SSRS reports to retrieve data which can be exported to many data types.

    Smart List is a good tool for users to get data, but it is not good for developing data farming with .net or vba modifier. Is the Smart List report you need a default report, or is it a custom built report using Smart List Builder? If it is the latter, you can basically copy the query used to get the data, and use this with a simple .net call to the GP database to get the same info directly to a collection, dataset, table, entity, csv, xml, json, etc..

    HTH,

    Joshua Pelkola

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans