logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
ron@verticalsoftware.net  
#1 Posted : Tuesday, March 13, 2018 4:47:39 PM(UTC)
ron@verticalsoftware.net

Rank: Member

Groups: Registered
Joined: 3/7/2018(UTC)
Posts: 13
United States
Location: Bartonville

Trying to get a list of accounts from CenterPoint using CenterpointAPI. Been messing with AccountListItem but can't seem to get any results.
tony  
#2 Posted : Tuesday, March 13, 2018 7:37:17 PM(UTC)
tony

Rank: Advanced Member

Groups: Registered
Joined: 2/28/2018(UTC)
Posts: 49
United States
Location: Pennsylvani mostly

Was thanked: 7 time(s) in 7 post(s)
AccountListItem is just a class used to hold basic information for one account.

It is used, for example, in the NamesPresenter which is used to add/edit/remove CenterPoint Names data (customers, vendors, etc.)

NamePresenter's GetApAccountList method returns a list of basic AP accounts information which can be used to get basic information about valid accounts for a name's DefaultAPAccountId property. We'd use this to populate a combo box for DefaultAPAccountId, for example.

However, we have a general purpose solution. You can use the CenterPoint Data Browser (there's a link to the documentation towards the bottom of the forum.)

With it you can retrieve data for any report in CenterPoint and it has a UI to help you generate code.

Here's what I've just done:

1. Opened the Data Browser's UI
2. Selected the report I wanted to get data from: Setup List -> Accounts -> Chart of Accounts
3. Clicked the Generate Code button
4. Here's the code it generated (which you would modify for your own use - for example, the databaseName variable is set to BusinessSample - you'd change that to the name of the database you want to get data from):
5. If you run that code as is, it returns a DataSet with a single data table containing the data generated by the Chart of Accounts report.

Code:

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CenterPointDataBrowser;

namespace CenterPointDataBrowser
{
   public class ReportDataExample
   {
      public DataSet GetReportData()
      {
         string databaseName = "BusinessSample";
         string reportKey = "01c8a28f-51ea-477c-bf6a-9b921ca30c34";

         // Initialize the API
         DataAccessAPI api = new DataAccessAPI();

         // Open the database
         api.OpenDatabase(databaseName); // there is an over-loaded method if you need to supply a user/name password

         // Retrieve the report
         Report report = api.GetReport(reportKey);

         // Uncomment the following line of code line if you do not want any filters 
         // If commented out, then the filters set in CP are applied.
         // report.ClearFilters(); 
         
         // Set filters (optional)


         // Uncomment the following line of code line if you do not want any options
         // If commented out, then the options set in CP are used
         // report.ClearOptions(); 

         // Set options (optional)


         // Gather the report's data
         //
         // Note: Some reports only return the data needed to produce the report. If you want
         // to return all data, then change GetReportData(false) to GetReportData(true)
         DataSet ds =  report.GetReportData(false); 

         // Close the database 
         api.CloseDatabase();
         return ds;
      }
   }
}

Edited by user Tuesday, March 13, 2018 8:41:58 PM(UTC)  | Reason: Not specified

Users browsing this topic
Guest
Forum Jump  
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.