FastSpring Connector for SAP Crystal Reports : Get account orders (for all accounts) via SQL
Learn how to get account orders (for all accounts) using the FastSpring Connector for SAP Crystal Reports. This connector enables you to read and write FastSpring data effortlessly. Integrate, manage, and automate orders, subscriptions, quotes, products, and accounts — almost no coding required. We'll walk you through the exact setup.
Let's dive in!
Create data source using FastSpring ODBC Driver
-
Download and install ODBC PowerPack (if you haven't already).
-
Search for
odbcand open the ODBC Data Sources (64-bit):
-
Create a User data source (User DSN) based on the ZappySys API Driver driver:
ZappySys API Driver
- Create and use a User DSN if the client application runs under a User Account. This is the ideal option at design time (e.g., when developing in Visual Studio). Use it for both types of applications (64-bit and 32-bit).
- Create and use a System DSN if the client application runs under a System Account (e.g., as a Windows Service). This is usually the required option in a production environment. If your Windows Service is a 32-bit application, you must use the 32-bit ODBC Data Source Administrator to configure this
-
When the Configuration window appears give your data source a name if you haven't done that already, then select "FastSpring" from the list of Popular Connectors. If "FastSpring" is not present in the list, then click "Search Online" and download it. Then set the path to the location where you downloaded it. Finally, click Continue >> to proceed with configuring the DSN:
FastspringDSNFastSpring
-
Now it's time to configure the Connection Manager. Select Authentication Type, e.g. Token Authentication. Then select API Base URL (in most cases, the default one is the right one). More info is available in the Authentication section.
FastSpring authentication
Here is how to obtain FastSpring API credentials:
- In the FastSpring portal, navigate to Developer Tools > APIs > API Credentials.
-
Click Create, FastSpring will automatically generate your Username and Password.
Copy them, we will need them in the next step:
WARNING: Securely store the credentials for future reference. -
Now go to SSIS package or ODBC data source and use this token in API Credentials authentication configuration:
- In the UserName field paste the Username value you copied in the previous step.
- In the Password field paste the Password value you copied in the previous step.
- Click Test Connection to confirm the connection is working.
- Done! Now you are ready to use FastSpring Connector!
API Connection Manager configuration
Just perform these simple steps to finish authentication configuration:
-
Set Authentication Type to
API Credentials [Http] - Optional step. Modify API Base URL if needed (in most cases default will work).
- Fill in all the required parameters and set optional parameters if needed.
- Finally, hit OK button:
FastspringDSNFastSpringAPI Credentials [Http]https://api.fastspring.comRequired Parameters UserName Fill-in the parameter... Password Fill-in the parameter... Optional Parameters RetryMode RetryWhenStatusCodeMatch RetryStatusCodeList 429 RetryCountMax 5 RetryMultiplyWaitTime True Your Webstore URL (Only used by get_products_visibility endpoint) https://YOUR-STORE.onfastspring.com
-
Then go to Preview tab to start building a SQL query.
-
Once you do that, proceed by opening Query Builder:
ZappySys API Driver - FastSpringRead and write FastSpring data effortlessly. Integrate, manage, and automate orders, subscriptions, quotes, products, and accounts — almost no coding required.FastspringDSN
-
Then simply select the Get Account Orders (For all accounts) endpoint (action).
-
Continue by configuring the Required parameters. You can also set optional parameters too.
-
Move on by hitting Preview Data button to preview the results.
-
If you see the results you need, simply copy the generated query:
-
Click OK to use built SQL query and close the Query Builder.
-
Now hit Preview Data button to preview the data using the generated SQL query. If you are satisfied with the result, use this query in SAP Crystal Reports:
ZappySys API Driver - FastSpringRead and write FastSpring data effortlessly. Integrate, manage, and automate orders, subscriptions, quotes, products, and accounts — almost no coding required.FastspringDSNSELECT * FROM AccountOrders WITH ( Email='bob@abc.com' ) --search by one or more parameters below /* WITH ( Email='X' , CustomKey='X' , GlobalKey='X' , OrderID='X' , OrderReference='X' , SubscriptionId='X' , Products='PROD-1,PROD-2,PROD-3' , Refunds='true' , SubscriptionStatus='active' ) */
You can also access data quickly from the tables dropdown by selecting <Select table>.AWHEREclause,LIMITkeyword will be performed on the client side, meaning that thewhole result set will be retrieved from the FastSpring API first, and only then the filtering will be applied to the data. If possible, it is recommended to use parameters in Query Builder to filter the data on the server side (in FastSpring servers).
Let's not stop here and explore SQL query examples, including how to use them in Stored Procedures and Views (virtual tables) in the next steps.
FastSpring SQL query examples
Use these SQL queries in your SAP Crystal Reports data source:
Read account orders by email
Gets account orders filtered by email or other criteria. Use the AccountOrders table and pass Email='...' (or CustomKey, OrderID, OrderReference, SubscriptionId, Products, Refunds, SubscriptionStatus) in the WITH clause.
SELECT * FROM AccountOrders
WITH (
Email='bob@abc.com'
)
--search by one or more parameters below
/*
WITH (
Email='X'
, CustomKey='X'
, GlobalKey='X'
, OrderID='X'
, OrderReference='X'
, SubscriptionId='X'
, Products='PROD-1,PROD-2,PROD-3'
, Refunds='true'
, SubscriptionStatus='active'
)
*/
get_account_orders endpoint belongs to
AccountOrders
table(s), and can therefore be used via those table(s).
Create SQL view in ODBC data source
ZappySys API Drivers support flexible Query language so you can override Default Properties you configured on Data Source such as URL, Body. This way you don't have to create multiple Data Sources if you like to read data from multiple EndPoints. However not every application support supplying custom SQL to driver so you can only select Table from list returned from driver.
If you're dealing with Microsoft Access and need to import data from an SQL query, it's important to note that Access doesn't allow direct import of SQL queries. Instead, you can create custom objects (Virtual Tables) to handle the import process.
Many applications like MS Access, Informatica Designer wont give you option to specify custom SQL when you import Objects. In such case Virtual Table is very useful. You can create many Virtual Tables on the same Data Source (e.g. If you have 50 URLs with slight variations you can create virtual tables with just URL as Parameter setting.
-
Go to Custom Objects Tab and Click on Add button and Select Add Table:
-
Enter the desired Table name and click on OK:
-
And it will open the New Query Window Click on Cancel to close that window and go to Custom Objects Tab.
-
Select the created table, Select Text Type AS SQL and write the your desired SQL Query and Save it and it will create the custom table in the ZappySys Driver:
Here is an example SQL query for ZappySys Driver. You can insert Placeholders also. Read more about placeholders here
SELECT "ShipCountry", "OrderID", "CustomerID", "EmployeeID", "OrderDate", "RequiredDate", "ShippedDate", "ShipVia", "Freight", "ShipName", "ShipAddress", "ShipCity", "ShipRegion", "ShipPostalCode" FROM "Orders" Where "ShipCountry"='USA'
-
That's it now go to Preview Tab and Execute your custom virtual table query. In this example it will extract the orders for the USA Shipping Country only:
SELECT * FROM "vt__usa_orders_only"
Get account orders in SAP Crystal Reports via SQL view
-
First of all, open SAP Crystal Reports and create the new Crystal Report.
-
And it will open the new data source selection window. Under ODBC(RDO) double click on the Make New Connection and Select the desired ODBC DSN, in our case we need to select FastspringDSN which we created in upper section. And Click on Next.
FastspringDSN
-
Expand the Connection and under the data select the desired table(s) or view(s) and click Add > button and click on Next.
FastspringDSNFastspringDSN
-
Add the desired Fields to Display in the Reports. Here we are adding all fields and click on Finish.
-
That's it and you will be able to load the data in the Report.
Advanced topics
Creating SQL stored procedures
You can create procedures to encapsulate custom logic and then only pass handful parameters rather than long SQL to execute your API call.
Steps to create Custom Stored Procedure in ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here
-
Go to Custom Objects Tab and Click on Add button and Select Add Procedure:
-
Enter the desired Procedure name and click on OK:
-
Select the created Stored Procedure and write the your desired stored procedure and Save it and it will create the custom stored procedure in the ZappySys Driver. Here is an example stored procedure for ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here
CREATE PROCEDURE [usp_get_orders] @fromdate = '<<yyyy-MM-dd,FUN_TODAY>>' AS SELECT * FROM Orders where OrderDate >= '<@fromdate>';
-
That's it now go to Preview Tab and Execute your Stored Procedure using Exec Command. In this example it will extract the orders from the date 1996-01-01:
Exec usp_get_orders '1996-01-01';
Conclusion
And there you have it — a complete guide on how to get account orders (for all accounts) in SAP Crystal Reports without writing complex code. All of this was powered by FastSpring ODBC Driver, which handled the REST API pagination and authentication for us automatically.
Download the trial now or ping us via chat if you have any questions or are looking for a specific feature (you can also reach out to us by submitting a ticket):
More actions supported by FastSpring Connector
Got another use case in mind? We've documented the exact setups for a variety of essential FastSpring operations directly in SAP Crystal Reports, so you can skip the trial and error. Find your next step-by-step guide below:
- Create Product
- Get Account By Id
- Get Account Charges
- Get Account Charges by Id
- Get Account Orders (For a single account)
- Get Accounts
- Get Order by Id
- Get Order Items
- Get Order Items by OrderId
- Get Orders
- Get Product
- Get Product IDs
- Get Product Prices
- Get Products
- Get Products Publish Status
- Get Quote By Id
- Get Quotes
- Get Revenue Report
- Get Subscription By Id
- Get Subscription Report
- Get Subscriptions
- Get Subscriptions Ids
- Update Product
- Make Generic REST API Request
- Make Generic REST API Request (Bulk Write)